yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaMultiple cast issue fix (#2940)7175f647f

master
587 B21 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
3
4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
5RWStructuredBuffer<int> outputBuffer;
6
7[numthreads(4, 1, 1)]
8void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
9{
10	uint tid = dispatchThreadID.x;
11    int idx = (int)tid;
12    
13    float q = (idx * 0.5);
14 
15    int x = (uint)(int)q;
16    
17    // This combination of casts and parenthesis used to cause issues. 
18    int z = ((uint)(int)q);
19    
20 	outputBuffer[tid] = z + x;
21}