mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
10a624ee75
This is our version of the standard message passing litmus test for atomics. It does a bunch in parallel and permutes the reads and writes extensively, so it's been more sensitive than existing tests.
55 lines
1.3 KiB
HLSL
Generated
55 lines
1.3 KiB
HLSL
Generated
struct Element
|
|
{
|
|
uint data;
|
|
uint flag;
|
|
};
|
|
|
|
static const uint3 gl_WorkGroupSize = uint3(256u, 1u, 1u);
|
|
|
|
RWByteAddressBuffer data_buf : register(u0);
|
|
RWByteAddressBuffer control_buf : register(u1);
|
|
|
|
static uint3 gl_GlobalInvocationID;
|
|
struct SPIRV_Cross_Input
|
|
{
|
|
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
|
};
|
|
|
|
uint permute_flag_ix(uint data_ix)
|
|
{
|
|
return (data_ix * 419u) & 65535u;
|
|
}
|
|
|
|
void comp_main()
|
|
{
|
|
uint _76;
|
|
data_buf.InterlockedExchange(gl_GlobalInvocationID.x * 8 + 0, 1u, _76);
|
|
DeviceMemoryBarrier();
|
|
uint param = gl_GlobalInvocationID.x;
|
|
uint write_flag_ix = permute_flag_ix(param);
|
|
uint _77;
|
|
data_buf.InterlockedExchange(write_flag_ix * 8 + 4, 1u, _77);
|
|
uint read_ix = (gl_GlobalInvocationID.x * 4099u) & 65535u;
|
|
uint param_1 = read_ix;
|
|
uint read_flag_ix = permute_flag_ix(param_1);
|
|
uint _58;
|
|
data_buf.InterlockedAdd(read_flag_ix * 8 + 4, 0, _58);
|
|
uint flag = _58;
|
|
DeviceMemoryBarrier();
|
|
uint _62;
|
|
data_buf.InterlockedAdd(read_ix * 8 + 0, 0, _62);
|
|
uint data = _62;
|
|
if (flag > data)
|
|
{
|
|
uint _73;
|
|
control_buf.InterlockedAdd(0, 1u, _73);
|
|
}
|
|
}
|
|
|
|
[numthreads(256, 1, 1)]
|
|
void main(SPIRV_Cross_Input stage_input)
|
|
{
|
|
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
|
comp_main();
|
|
}
|