summaryrefslogtreecommitdiff
path: root/tests/bugs/uav-write-index.hlsl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs/uav-write-index.hlsl')
-rw-r--r--tests/bugs/uav-write-index.hlsl31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/bugs/uav-write-index.hlsl b/tests/bugs/uav-write-index.hlsl
new file mode 100644
index 000000000..667c73e89
--- /dev/null
+++ b/tests/bugs/uav-write-index.hlsl
@@ -0,0 +1,31 @@
+//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking
+
+// Make sure we handle complex UAV write patterns
+
+// Force import of Slang to ensure that some
+// checking takes place:
+#ifdef __SLANG__
+__import empty;
+#endif
+
+struct Bar
+{
+ uint bar;
+};
+
+RWStructuredBuffer<Bar> gUAV : register(u0);
+
+void foo(RWTexture1D<float2> uav)
+{
+ uint index = gUAV.IncrementCounter();
+ gUAV[index].bar = 1;
+ uav[index] = float2(0,0);
+}
+
+RWTexture1D<float2> gUAV2 : register(u1);
+
+[numthreads(1,1,1)]
+void main()
+{
+ foo(gUAV2);
+}