summaryrefslogtreecommitdiff
path: root/tests/compute/vector-scalar-compare.slang
blob: aa9580b5cfc205e22c90d7dd511ff3ffe8b05bbf (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
//TEST(compute):COMPARE_COMPUTE:-dx12 -compute 
//TEST(compute):COMPARE_COMPUTE:-vk -compute 
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out

// Test doing vector comparisons 
RWStructuredBuffer<int> outputBuffer;

[numthreads(4, 4, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint2 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;
}