diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-03-04 18:32:52 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2020-03-04 18:42:31 +0300 |
commit | c27e1efbf18cff858db35a3eda5dcdde7ad450d6 (patch) | |
tree | e29942a8dd4d5de808c326741da4bfedb66e02c4 /reference/shaders-hlsl | |
parent | 01968c448604665593b50c5206a50bf849753464 (diff) |
HLSL: Add option to always treat SSBO as UAV, even with readonly.
This can make codegen more predictable since ByteAddressBuffer is SRV
and not UAV.
Diffstat (limited to 'reference/shaders-hlsl')
-rw-r--r-- | reference/shaders-hlsl/comp/access-chains.force-uav.comp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/reference/shaders-hlsl/comp/access-chains.force-uav.comp b/reference/shaders-hlsl/comp/access-chains.force-uav.comp new file mode 100644 index 00000000..97d046d8 --- /dev/null +++ b/reference/shaders-hlsl/comp/access-chains.force-uav.comp @@ -0,0 +1,23 @@ +static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u); + +RWByteAddressBuffer wo : register(u1); +RWByteAddressBuffer ro : register(u0); + +static uint3 gl_GlobalInvocationID; +struct SPIRV_Cross_Input +{ + uint3 gl_GlobalInvocationID : SV_DispatchThreadID; +}; + +void comp_main() +{ + wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160)))); + wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480)))); +} + +[numthreads(1, 1, 1)] +void main(SPIRV_Cross_Input stage_input) +{ + gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID; + comp_main(); +} |