diff options
Diffstat (limited to 'tests/language-feature/modules')
| -rw-r--r-- | tests/language-feature/modules/wrapper-inout.slang | 29 | ||||
| -rw-r--r-- | tests/language-feature/modules/wrapper-property.slang | 24 |
2 files changed, 53 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 diff --git a/tests/language-feature/modules/wrapper-property.slang b/tests/language-feature/modules/wrapper-property.slang new file mode 100644 index 000000000..cfd9798b7 --- /dev/null +++ b/tests/language-feature/modules/wrapper-property.slang @@ -0,0 +1,24 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +//CHECK: OpEntryPoint + +public interface ITest { + public property int val; +}; + +public struct TestImpl : ITest { + public int val; +} + +public struct Test : ITest = TestImpl; + +StructuredBuffer<Test> data; +RWStructuredBuffer<int> output; + +[shader("compute")] +[numthreads(1,1,1)] +void computeMain() +{ + int val = data[0].val; + output[0] = val; +}
\ No newline at end of file |
