diff options
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/struct-make.slang | 30 | ||||
| -rw-r--r-- | tests/compute/struct-make.slang.expected.txt | 4 |
2 files changed, 34 insertions, 0 deletions
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<int> 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 |
