summaryrefslogtreecommitdiffstats
path: root/tests/compute/vector-scalar-compare.slang
blob: dedeeda455931d069b866a67bb08b041e39c3c5c (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
27
//TEST(compute):COMPARE_COMPUTE:-dx12 -compute -shaderobj 
//TEST(compute):COMPARE_COMPUTE:-vk -compute  -shaderobj
//TEST(compute):COMPARE_COMPUTE:-cuda -compute  -shaderobj

// Test doing vector comparisons 

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

[numthreads(4, 4, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
    int2 threadInGroup = dispatchThreadID.xy;
    
    int r = 0;
    if(all((threadInGroup & 1) == 0))
    {
        r = 0;
    }
    else
    {   
        r = 1;
    }
   
    int index = threadInGroup.x + threadInGroup.y * 4; 
    outputBuffer[index] = r;
}