Debian Codegraph @

tests/manual/rhi/float16texture_with_compute/load.comp

raw
1 #version 440
2
3 layout(local_size_x = 16, local_size_y = 16) in;
4 layout(rgba8, binding = 1) readonly uniform image2D inputImage;
5 layout(rgba16f, binding = 2) writeonly uniform image2D outputImage;
6
7 // There is no equivalent of gl_NumWorkGroups in HLSL. So instead pass the
8 // values in in a uniform buffer.
9 layout(std140, binding = 0) uniform numWorkGroupsBuf {
10 uvec3 numWorkGroups;
11 };
12
13 void main()
14 {
15 if (gl_GlobalInvocationID.x >= numWorkGroups.x || gl_GlobalInvocationID.y >= numWorkGroups.y)
16 return;
17 vec4 value = imageLoad(inputImage, ivec2(gl_GlobalInvocationID.xy));
18 imageStore(outputImage, ivec2(gl_GlobalInvocationID.xy), value);
19 }