diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-05-09 23:26:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 20:26:43 -0700 |
| commit | 48203ea02250ba517f749a222092f091d9bef15e (patch) | |
| tree | 75663fe17fcbae4a376d9cdbe31393de43171e7c /tests | |
| parent | 5a6c2baadbc16fc2099a6951e389b9bd3cad08f6 (diff) | |
Fix SPIRV unsigned to signed widening casts (#7051)
* Fix unsigned to signed casts for SPIRV
* Add test
* Fix ICE crash
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/spirv/int-cast-unsigned-to-signed.slang | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/spirv/int-cast-unsigned-to-signed.slang b/tests/spirv/int-cast-unsigned-to-signed.slang new file mode 100644 index 000000000..0ec3203a4 --- /dev/null +++ b/tests/spirv/int-cast-unsigned-to-signed.slang @@ -0,0 +1,35 @@ +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -shaderobj -output-using-type + +//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +//TEST_INPUT:ubuffer(data=[200], stride=4):name input1 +RWStructuredBuffer<uint8_t> input1; + +//TEST_INPUT:ubuffer(data=[35000], stride=4):name input2 +RWStructuredBuffer<uint16_t> input2; + +//TEST_INPUT:ubuffer(data=[201], stride=4):name input3 +RWStructuredBuffer<uint8_t> input3; + +// +// Tests unsigned to signed casts to wider int. +// + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint index = dispatchThreadID.x; + + // BUF: 200 + outputBuffer[index] = input1[0]; + + // BUF: 35000 + outputBuffer[index + 1] = input2[0]; + + // BUF: 201 + int16_t a = input3[0]; + outputBuffer[index + 2] = a; +} |
