https://github.com/shader-slang/slang
Raw File
Tip revision: cc222702a8d7a1fccf8ad14b256570bcec1554ae authored by Yong He on 03 November 2023, 19:49:23 UTC
Add more diagnostics on invalid custom derivative use. (#3309)
Tip revision: cc22270
select-expr.slang
//TEST(smoke,compute):COMPARE_COMPUTE: -shaderobj
//TEST(smoke,compute):COMPARE_COMPUTE:-cpu -shaderobj

// Test IR code generation for the `?:` "select" operator

int test(int input)
{
	return input > 1 ? -input : input;
}

//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)
{
    outputBuffer[dispatchThreadID.x] = test((int) dispatchThreadID.x);
}
back to top