Revision control
Copy as Markdown
#version 430
// One thread per work group. Each work group writes a sentinel-masking
// value into its own slot of the output buffer, keyed by gl_WorkGroupID
// packed with a fixed stride. The stride is picked large enough to fit any
// grid used by the test (up to 16 groups per dimension); this avoids using
// gl_NumWorkGroups, which SPIRV-Cross cannot translate to HLSL without a
// dedicated remap option.
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(std430, binding = 0) buffer OutputBuffer
{
uint values[];
} outBuf;
void main()
{
uint idx = gl_WorkGroupID.x
+ gl_WorkGroupID.y * 16u
+ gl_WorkGroupID.z * 16u * 16u;
outBuf.values[idx] = (gl_WorkGroupID.z << 20)
| (gl_WorkGroupID.y << 10)
| gl_WorkGroupID.x;
}