yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Darren WihandiFix SPIRV unsigned to signed widening casts (#7051)48203ea02

master
1.0 KiB35 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -shaderobj  -output-using-type
2//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute -shaderobj -output-using-type
3//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cuda -compute -shaderobj -output-using-type
4
5//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name outputBuffer
6RWStructuredBuffer<int> outputBuffer;
7
8//TEST_INPUT:ubuffer(data=[200], stride=4):name input1
9RWStructuredBuffer<uint8_t> input1;
10
11//TEST_INPUT:ubuffer(data=[35000], stride=4):name input2
12RWStructuredBuffer<uint16_t> input2;
13
14//TEST_INPUT:ubuffer(data=[201], stride=4):name input3
15RWStructuredBuffer<uint8_t> input3;
16
17//
18// Tests unsigned to signed casts to wider int.
19//
20
21[numthreads(1, 1, 1)]
22void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
23{
24    uint index = dispatchThreadID.x;
25
26    // BUF: 200
27    outputBuffer[index] = input1[0];
28
29    // BUF: 35000
30    outputBuffer[index + 1] = input2[0];
31
32    // BUF: 201
33    int16_t a = input3[0];
34    outputBuffer[index + 2] = a;
35}