summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-10-02 15:39:34 -0700
committerGitHub <noreply@github.com>2023-10-02 15:39:34 -0700
commitd87493a46c00be37b820a473c0827bbb865eb222 (patch)
tree33155e6be017238e07314f7793423dd50b748150 /tests
parentcea230bc686ef87db4cff47e367bbf824b90377d (diff)
More direct-SPIRV fixes. (#3257)
* More direct-SPIRV fixes. * Fix array-reg-to-mem. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/spirv/mutating-method-syn.slang38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/spirv/mutating-method-syn.slang b/tests/spirv/mutating-method-syn.slang
new file mode 100644
index 000000000..14adc001f
--- /dev/null
+++ b/tests/spirv/mutating-method-syn.slang
@@ -0,0 +1,38 @@
+// mutating-method-syn.slang
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute
+// Test ability to directly output SPIR-V
+
+interface IFoo
+{
+ [mutating]
+ int bar(inout int y);
+}
+
+struct Val : IFoo
+{
+ int x;
+
+ int bar(int y)
+ {
+ return x + y;
+ }
+}
+
+int test<T:IFoo>(inout T f, inout int y)
+{
+ return f.bar(y);
+}
+
+//TEST_INPUT:set result = out ubuffer(data=[0 0 0 0], stride=4)
+
+RWStructuredBuffer<int> result;
+[numthreads(1,1,1)]
+void computeMain()
+{
+ Val v;
+ int y = 0;
+ v.x = 1;
+
+ // CHECK: 1
+ result[0] = test(v, y);
+}