summaryrefslogtreecommitdiff
path: root/tests/language-feature/modules/wrapper-inout.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-12-30 23:39:07 -0800
committerGitHub <noreply@github.com>2024-12-30 23:39:07 -0800
commitcc1b96d91d8875bf727079d58fbf78af1135f505 (patch)
tree593a6aae09e2710390ac34fdeb84614872ac9d5f /tests/language-feature/modules/wrapper-inout.slang
parent88e221bad60ce20087fe2f8a85d506be36a6e6ca (diff)
Check mismatching method parameter direction against interface declaration. (#5964)
Diffstat (limited to 'tests/language-feature/modules/wrapper-inout.slang')
-rw-r--r--tests/language-feature/modules/wrapper-inout.slang29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/language-feature/modules/wrapper-inout.slang b/tests/language-feature/modules/wrapper-inout.slang
new file mode 100644
index 000000000..5b7b9fbce
--- /dev/null
+++ b/tests/language-feature/modules/wrapper-inout.slang
@@ -0,0 +1,29 @@
+//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -output-using-type
+
+public interface ITest {
+ public int testDir(inout int a);
+};
+
+public struct TestImpl : ITest {
+ public int testDir(inout int a) {
+ int oldA = a;
+ a = 5;
+ return a;
+ }
+}
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=output
+RWStructuredBuffer<int> output;
+
+public struct Test : ITest = TestImpl;
+
+[shader("compute")]
+[numthreads(1,1,1)]
+void computeMain()
+{
+ Test data;
+ int a = 516;
+ int b = data.testDir(a);
+ // CHECK: 5
+ output[0] = b;
+} \ No newline at end of file