diff options
Diffstat (limited to 'tests/compute/enum-tag-conversion.slang')
| -rw-r--r-- | tests/compute/enum-tag-conversion.slang | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/compute/enum-tag-conversion.slang b/tests/compute/enum-tag-conversion.slang new file mode 100644 index 000000000..66b4923e5 --- /dev/null +++ b/tests/compute/enum-tag-conversion.slang @@ -0,0 +1,31 @@ +// enum-tag-conversion.slang + +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute + +// Confirm that a value of `enum` type can have an initializer +// that includes basic operations like type conversion. + +enum RoseColors +{ + Red = 16u, +} + +int test(int val) +{ + return val + RoseColors.Red; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + + int val = int(tid); + val = test(val); + + outputBuffer[tid] = val; +}
\ No newline at end of file |
