diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-09 21:52:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-09 21:52:13 -0700 |
| commit | d4e72a93e13ab880b2f355fb7fb5d55cf0113c3d (patch) | |
| tree | e252c9164da2aa2632350abab9cb73d2a524533c /tests | |
| parent | f875d3f5ba9c1ddc6aa9a0960efd5ab27ae4e4c9 (diff) | |
Support nested structs in function bodies. (#3078)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/language-feature/struct-in-func.slang | 24 | ||||
| -rw-r--r-- | tests/language-feature/struct-in-func.slang.expected.txt | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/language-feature/struct-in-func.slang b/tests/language-feature/struct-in-func.slang new file mode 100644 index 000000000..d3bd046f0 --- /dev/null +++ b/tests/language-feature/struct-in-func.slang @@ -0,0 +1,24 @@ +//TEST(compute):COMPARE_COMPUTE: -shaderobj +//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj + +int test(int r) +{ + struct Val + { + int a; + int b; + } + Val a; + a.a = 1; + a.b = 2; + return a.a + a.b; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + outputBuffer[0] = test(dispatchThreadID.x); +} diff --git a/tests/language-feature/struct-in-func.slang.expected.txt b/tests/language-feature/struct-in-func.slang.expected.txt new file mode 100644 index 000000000..e440e5c84 --- /dev/null +++ b/tests/language-feature/struct-in-func.slang.expected.txt @@ -0,0 +1 @@ +3
\ No newline at end of file |
