diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-04-05 17:53:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-05 17:53:41 -0400 |
| commit | 464ecb6083f64f903df19b961e2af0075bdf3111 (patch) | |
| tree | 6dbb83f694b175cf8bf71f937c467b1ca27a0f62 /tests | |
| parent | 7f36c34daf633dcade3a3bab9cdcf14a34fed3cd (diff) | |
Fix issue with multiple namespace openings (#2176)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Added sample-grad-clamp-lod sample.
* Fix handling multiple reopenings of namespaces.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/language-feature/namespaces/multiple-namespace.slang | 56 | ||||
| -rw-r--r-- | tests/language-feature/namespaces/multiple-namespace.slang.expected.txt | 4 |
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/language-feature/namespaces/multiple-namespace.slang b/tests/language-feature/namespaces/multiple-namespace.slang new file mode 100644 index 000000000..a687d5e79 --- /dev/null +++ b/tests/language-feature/namespaces/multiple-namespace.slang @@ -0,0 +1,56 @@ +// multiple-namespace.slang + +//TEST(compute):COMPARE_COMPUTE: -shaderobj + +// Multiple namespace open/closing + +namespace A +{ + struct Struct1 + { + int a; + } +} + +namespace A +{ + struct Struct2 + { + int b; + } +} + +namespace A +{ + struct Struct3 + { + int c; + } +} + +// A few more + +namespace A {} +namespace A {} +namespace A { namespace A {} } + +int test(int val) +{ + A.Struct1 s1 = {}; + A::Struct2 s2 = { val }; + A.Struct3 s3 = { val * val }; + + return s1.a + s2.b + s3.c; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int inVal = tid; + int outVal = test(inVal); + outputBuffer[tid] = outVal; +} diff --git a/tests/language-feature/namespaces/multiple-namespace.slang.expected.txt b/tests/language-feature/namespaces/multiple-namespace.slang.expected.txt new file mode 100644 index 000000000..bfb7eefe7 --- /dev/null +++ b/tests/language-feature/namespaces/multiple-namespace.slang.expected.txt @@ -0,0 +1,4 @@ +0 +2 +6 +C |
