https://github.com/shader-slang/slang
Raw File
Tip revision: 9dfaabe0fbcc9ac7314f84bde89c658b276298e3 authored by Theresa Foley on 25 June 2021, 22:50:29 UTC
Fixes related to combined texture/sampler types (#1894)
Tip revision: 9dfaabe
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