summaryrefslogtreecommitdiffstats
path: root/tests/current-bugs
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-04-08 14:45:11 -0400
committerGitHub <noreply@github.com>2021-04-08 14:45:11 -0400
commitd27557d9b770810402a0bf99bcd891c145a1a69d (patch)
treec1cca6c2f332a28d4cbfdd191019f791e4a777fe /tests/current-bugs
parent65abe51040d714016c14494b022abaeab638234b (diff)
Test for specialization problem with undefined resource (#1785)
* #include an absolute path didn't work - because paths were taken to always be relative. * Test for bug around specialization.
Diffstat (limited to 'tests/current-bugs')
-rw-r--r--tests/current-bugs/specialize-with-undefined-resource.slang36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/current-bugs/specialize-with-undefined-resource.slang b/tests/current-bugs/specialize-with-undefined-resource.slang
new file mode 100644
index 000000000..50b006368
--- /dev/null
+++ b/tests/current-bugs/specialize-with-undefined-resource.slang
@@ -0,0 +1,36 @@
+//DISABLE_TEST:SIMPLE:-target dxil -entry computeMain -profile cs_6_2
+
+struct ValueContainer
+{
+ Texture2D<uint> values;
+
+ uint getValue(uint2 at)
+ {
+ return values[at];
+ }
+};
+
+ParameterBlock<ValueContainer> gContainer;
+
+Texture2D<uint> gValues;
+
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 4, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ ValueContainer container;
+
+ // This will work
+ // container = gContainer;
+ // Or just setting directly
+ // container.values = gValues;
+
+ // But if values in container is not .... then specialization fails
+ // and invalid HLSL is output.
+
+ uint2 pos = dispatchThreadID.xy;
+
+ outputBuffer[pos.x + pos.y] = container.getValue(pos);
+}
+