https://github.com/shader-slang/slang
Raw File
Tip revision: f5dfa1ed6a51809e8593f5f2abc292ab39f35dcb authored by Tim Foley on 11 May 2020, 21:57:05 UTC
Add GLSL translation for HLSL fmod() (#1342)
Tip revision: f5dfa1e
select-expr.slang
//TEST(smoke,compute):COMPARE_COMPUTE:
//TEST(smoke,compute):COMPARE_COMPUTE:-cpu

// 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