SPIRV-Cross/reference/shaders-hlsl/asm/comp/atomic-increment.asm.comp
2018-09-17 15:54:21 +02:00

25 lines
560 B
Plaintext

RWByteAddressBuffer u0_counter : register(u1);
RWBuffer<uint> u0 : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
uint _29;
u0_counter.InterlockedAdd(0, 1, _29);
float4 r0;
r0.x = asfloat(_29);
u0[(uint(asint(r0.x)) * 1u) + (uint(0) >> 2u)] = uint(int(gl_GlobalInvocationID.x)).x;
}
[numthreads(4, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}