https://github.com/shader-slang/slang
Raw File
Tip revision: 7be108c379ccc7da3f46b30a2b5917104155d52b authored by Yong He on 27 April 2023, 05:40:06 UTC
Intellisense: show info on decl kind and differentiability. (#2847)
Tip revision: 7be108c
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