https://github.com/shader-slang/slang
Raw File
Tip revision: 8a70e20df6f47678c146eb29f89655aa734f97c7 authored by jsmall-nvidia on 06 October 2020, 17:30:55 UTC
InterlockedExchangeU64 support on RWByteAddressBuffer (#1572)
Tip revision: 8a70e20
inout.slang
//TEST(compute):COMPARE_COMPUTE:
//TEST(compute):COMPARE_COMPUTE:-cpu

// Test that we correctly support both `out`
// and `inout` function parameters.

void testOut(int x, out int y)
{
	y = x;
}

void testInOut(int x, in out int y)
{
	y = y + x;
}

void testInout(int x, inout int y)
{
	y = y + x;	
}

int test(int inVal)
{
	int x0 = inVal;
	int x1;

	testOut(x0, x1);

	int x2 = x0;
	testInOut(x1, x2);

	int x3 = x0;
	testInout(x2, x3);

	return x3;
}

//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer : register(u0);

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
	uint tid = dispatchThreadID.x;
	int inVal = outputBuffer[tid];
	int outVal = test(inVal);
	outputBuffer[tid] = outVal;
}
back to top