diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-06-20 11:55:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-20 11:55:08 -0400 |
| commit | 79b0a2a555d17bb2fd3f391be83bab4809288075 (patch) | |
| tree | 34b7fb2dc62a275b3a124e20eaae04d5d7985b28 /tests | |
| parent | f161686e8e260a4b0e6e0a773cf1cf16069f41bf (diff) | |
Fix for generic with scope issue (#2925)
* Small fixes and improvements around reflection tool.
* Make PrettyWriter printing a class.
* Sundary improvements around StringBlob.
* Fix for generic scope issue.
* Fix expected output.
* Add scope-generic test.
---------
Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/scope-generic.slang | 46 | ||||
| -rw-r--r-- | tests/bugs/scope-generic.slang.expected.txt | 6 |
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/bugs/scope-generic.slang b/tests/bugs/scope-generic.slang new file mode 100644 index 000000000..9ebe226fe --- /dev/null +++ b/tests/bugs/scope-generic.slang @@ -0,0 +1,46 @@ +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj + +struct Test1 +{ + struct A<let N : uint = 2> + { + static uint num() { return N; } + }; + + static uint num() { return A<2>::num(); } + + typealias B = A<2>; +}; + +struct Test2 +{}; + +extension Test2 +{ + struct A<let N : uint = 2> + { + static uint num() { return N; } + }; + + static uint num() + { + return A<2>::num(); + } + + typealias B = A<2>; +}; + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<uint> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + outputBuffer[0] = Test1::num(); + outputBuffer[1] = Test1::B::num(); + outputBuffer[2] = Test1::A<2>::num(); + + outputBuffer[3] = Test2::num(); + outputBuffer[4] = Test2::B::num(); + outputBuffer[5] = Test2::A<2>::num(); +}
\ No newline at end of file diff --git a/tests/bugs/scope-generic.slang.expected.txt b/tests/bugs/scope-generic.slang.expected.txt new file mode 100644 index 000000000..5ee4e7592 --- /dev/null +++ b/tests/bugs/scope-generic.slang.expected.txt @@ -0,0 +1,6 @@ +2 +2 +2 +2 +2 +2 |
