summaryrefslogtreecommitdiffstats
path: root/tests/bugs/parens-cast-issue.slang
blob: 2cfe603c8e340e931df61ba248dfdda2815ce6f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
	uint tid = dispatchThreadID.x;
    int idx = (int)tid;
    
    float q = (idx * 0.5);
 
    int x = (uint)(int)q;
    
    // This combination of casts and parenthesis used to cause issues. 
    int z = ((uint)(int)q);
    
 	outputBuffer[tid] = z + x;
}