diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/enum-tag-conversion.slang | 31 | ||||
| -rw-r--r-- | tests/compute/enum-tag-conversion.slang.expected.txt | 4 |
2 files changed, 35 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 diff --git a/tests/compute/enum-tag-conversion.slang.expected.txt b/tests/compute/enum-tag-conversion.slang.expected.txt new file mode 100644 index 000000000..a0d427709 --- /dev/null +++ b/tests/compute/enum-tag-conversion.slang.expected.txt @@ -0,0 +1,4 @@ +10 +11 +12 +13 |
