File: spv.qcom.tileShading.1.comp

package info (click to toggle)
glslang 16.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 51,712 kB
  • sloc: cpp: 92,305; yacc: 4,320; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (39 lines) | stat: -rw-r--r-- 1,528 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#version 460
#extension GL_QCOM_tile_shading : enable 

layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
layout (shading_rate_xQCOM = 2, shading_rate_yQCOM = 2, shading_rate_zQCOM = 3) in;

layout (set=0, binding=0, tile_attachmentQCOM, rgba32f) uniform highp image2D input0;

// tile color attachments (new syntax)
layout (set=0, binding=1, tile_attachmentQCOM, rgba32f) uniform highp image2D  color0; // attachment0
layout (set=0, binding=2, tile_attachmentQCOM, rgba32i) uniform highp iimage2D color1; // attachment1


// depth/stencil attachments
layout (set=0, binding=3, tile_attachmentQCOM, rgba32f) uniform highp image2D  depth;
layout (set=0, binding=4, tile_attachmentQCOM, rgba32ui) uniform highp uimage2D stencil;

void main ()
{
  uvec2 uoffset = clamp(gl_GlobalInvocationID.xy, gl_TileOffsetQCOM, gl_TileOffsetQCOM + gl_TileDimensionQCOM.xy - uvec2(1.1));
  ivec2 offset = ivec2(uoffset);

  // read from attachments 
  vec4  colorA   = imageLoad( color0, offset );
  ivec4 icolorB  = imageLoad( color1, offset );
  vec4  colorC   = imageLoad( input0, offset );
  float d        = imageLoad( depth, offset ).x;
  uint  s        = imageLoad( stencil, offset ).x;
  
  // compute output values
  vec4 outColor   = ( colorA + vec4(icolorB) + colorC ) * 0.33f;
  float outDepth  = d * 2.0f;
  uint outStencil = s + uint(1);
  
  // write to attachments
  imageStore( color0,  offset, outColor );
  imageStore( depth,   offset, vec4(outDepth) );
  imageStore( stencil, offset, uvec4(outStencil) );
}