summaryrefslogtreecommitdiffstats
path: root/tests/hlsl-intrinsic/scalar-uint.slang
blob: ed4bd419f1368b980548d96439b0c827b05abba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -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 idx = dispatchThreadID.x;
    
    uint ti = 0;
    
    ti += max(2, idx);
    ti += min(idx, 1);
    ti += (idx * 3) %5;
    
    ti += clamp(idx * 10, 11, 23);
    
    ti += countbits(idx * 13);
    
    outputBuffer[idx] = int(ti); 
}