From 79b0a2a555d17bb2fd3f391be83bab4809288075 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 20 Jun 2023 11:55:08 -0400 Subject: 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> --- tests/bugs/scope-generic.slang | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/bugs/scope-generic.slang (limited to 'tests/bugs/scope-generic.slang') 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 + { + static uint num() { return N; } + }; + + static uint num() { return A<2>::num(); } + + typealias B = A<2>; +}; + +struct Test2 +{}; + +extension Test2 +{ + struct A + { + 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 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 -- cgit v1.2.3