summaryrefslogtreecommitdiff
path: root/tests/language-feature/resource-specialization-struct-return.slang
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-07-30 23:03:24 -0400
committerGitHub <noreply@github.com>2024-07-30 20:03:24 -0700
commitfef0a87ddee9c0f252a6625395b684b1cb5d85e0 (patch)
tree48c3f52e1b4395123d080971e10bc6009f41e8fb /tests/language-feature/resource-specialization-struct-return.slang
parentff6519f0bc11ccb71fe5863d3de92660eeedfb5d (diff)
Fix invalid code generation for when using nested resource specialization (#4751)
Diffstat (limited to 'tests/language-feature/resource-specialization-struct-return.slang')
-rw-r--r--tests/language-feature/resource-specialization-struct-return.slang29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/language-feature/resource-specialization-struct-return.slang b/tests/language-feature/resource-specialization-struct-return.slang
new file mode 100644
index 000000000..ca01f55d2
--- /dev/null
+++ b/tests/language-feature/resource-specialization-struct-return.slang
@@ -0,0 +1,29 @@
+//TEST:SIMPLE(filecheck=CHECK_DXIL):-target dxil -entry computeMain -profile cs_6_2
+//CHECK_DXIL: computeMain
+
+// This test demonstrates returning struct with resource.
+
+RWTexture1D<int> g_t;
+RWStructuredBuffer<int> outputBuffer;
+
+struct Thing
+{
+ int a;
+ RWTexture1D<int> t;
+};
+
+Thing makeThing()
+{
+ Thing t;
+ t.a = 10;
+ t.t = g_t;
+ return t;
+}
+
+[numthreads(4, 4, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int x = dispatchThreadID.x;
+ Thing thing = makeThing();
+ outputBuffer[dispatchThreadID.x] = x + thing.t.Load(1);
+} \ No newline at end of file