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