Debian Codegraph @

third_party/spirv-cross/reference/shaders/amd/shader_ballot.comp

raw
1 #version 450
2 #extension GL_ARB_gpu_shader_int64 : require
3 #extension GL_ARB_shader_ballot : require
4 #extension GL_AMD_shader_ballot : require
5 layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
6
7 layout(binding = 0, std430) buffer inputData
8 {
9 float inputDataArray[];
10 } _12;
11
12 layout(binding = 1, std430) buffer outputData
13 {
14 float outputDataArray[];
15 } _74;
16
17 void main()
18 {
19 float thisLaneData = _12.inputDataArray[gl_LocalInvocationID.x];
20 bool laneActive = thisLaneData > 0.0;
21 uint thisLaneOutputSlot = mbcntAMD(packUint2x32(uvec2(uvec4(unpackUint2x32(ballotARB(laneActive)), 0u, 0u).xy)));
22 int firstInvocation = readFirstInvocationARB(1);
23 int invocation = readInvocationARB(1, 0u);
24 vec3 swizzleInvocations = swizzleInvocationsAMD(vec3(0.0, 2.0, 1.0), uvec4(3u));
25 vec3 swizzelInvocationsMasked = swizzleInvocationsMaskedAMD(vec3(0.0, 2.0, 1.0), uvec3(2u));
26 vec3 writeInvocation = writeInvocationAMD(swizzleInvocations, swizzelInvocationsMasked, 0u);
27 if (laneActive)
28 {
29 _74.outputDataArray[thisLaneOutputSlot] = thisLaneData;
30 }
31 }
32