https://github.com/shader-slang/slang
Raw File
Tip revision: 7cff340b10b27f82781335093759bbdc19cd2865 authored by Yong He on 21 January 2022, 20:13:23 UTC
Add entry-point name override feature. (#2089)
Tip revision: 7cff340
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