yum-mirror/glslang

git clone https://git.yummers.dev/yum-mirror/glslang

Wooyoung KimAdd the GLSL_QCOM_tile_shading support10ae0e16

main
1.5 KiB39 linesraw
1#version 460
2#extension GL_QCOM_tile_shading : enable 
3
4layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
5layout (shading_rate_xQCOM = 2, shading_rate_yQCOM = 2, shading_rate_zQCOM = 3) in;
6
7layout (set=0, binding=0, tile_attachmentQCOM, rgba32f) uniform highp image2D input0;
8
9// tile color attachments (new syntax)
10layout (set=0, binding=1, tile_attachmentQCOM, rgba32f) uniform highp image2D  color0; // attachment0
11layout (set=0, binding=2, tile_attachmentQCOM, rgba32i) uniform highp iimage2D color1; // attachment1
12
13
14// depth/stencil attachments
15layout (set=0, binding=3, tile_attachmentQCOM, rgba32f) uniform highp image2D  depth;
16layout (set=0, binding=4, tile_attachmentQCOM, rgba32ui) uniform highp uimage2D stencil;
17
18void main ()
19{
20  uvec2 uoffset = clamp(gl_GlobalInvocationID.xy, gl_TileOffsetQCOM, gl_TileOffsetQCOM + gl_TileDimensionQCOM.xy - uvec2(1.1));
21  ivec2 offset = ivec2(uoffset);
22
23  // read from attachments 
24  vec4  colorA   = imageLoad( color0, offset );
25  ivec4 icolorB  = imageLoad( color1, offset );
26  vec4  colorC   = imageLoad( input0, offset );
27  float d        = imageLoad( depth, offset ).x;
28  uint  s        = imageLoad( stencil, offset ).x;
29  
30  // compute output values
31  vec4 outColor   = ( colorA + vec4(icolorB) + colorC ) * 0.33f;
32  float outDepth  = d * 2.0f;
33  uint outStencil = s + uint(1);
34  
35  // write to attachments
36  imageStore( color0,  offset, outColor );
37  imageStore( depth,   offset, vec4(outDepth) );
38  imageStore( stencil, offset, uvec4(outStencil) );
39}