https://github.com/shader-slang/slang
Raw File
Tip revision: 25eeb10a9731b0980f63709d0141ba2cccc954b5 authored by Tim Foley on 21 February 2020, 19:42:27 UTC
Add some missing support for Shader Model 6.4/6.5 (#1237)
Tip revision: 25eeb10
vector-scalar-compare.slang
//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;
}
back to top