From f07834e19a34d5f9c03d681083b5ba30e262889d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 12 Feb 2020 16:47:14 -0500 Subject: Nvrtc disable warnings/Float literal improvements (#1220) * Added 'truncate' for fixing floats, for floats near the max value (as opposed to making infinite). Put AreNearlyEqual into Math * Test for ::make static method. --- tests/compute/struct-make.slang | 30 ++++++++++++++++++++++++++++ tests/compute/struct-make.slang.expected.txt | 4 ++++ 2 files changed, 34 insertions(+) create mode 100644 tests/compute/struct-make.slang create mode 100644 tests/compute/struct-make.slang.expected.txt (limited to 'tests') diff --git a/tests/compute/struct-make.slang b/tests/compute/struct-make.slang new file mode 100644 index 000000000..265370b89 --- /dev/null +++ b/tests/compute/struct-make.slang @@ -0,0 +1,30 @@ +// scope.slang +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute +//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute + +// Confirm that scoping on enums and types works + +struct Thing +{ + int a; + static Thing make(int v) + { + Thing thing; + thing.a = v; + return thing; + } +}; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + + Thing thing = Thing::make(tid); + + outputBuffer[tid] = thing.a; +} \ No newline at end of file diff --git a/tests/compute/struct-make.slang.expected.txt b/tests/compute/struct-make.slang.expected.txt new file mode 100644 index 000000000..bc856dafa --- /dev/null +++ b/tests/compute/struct-make.slang.expected.txt @@ -0,0 +1,4 @@ +0 +1 +2 +3 -- cgit v1.2.3