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
parameter-block.slang
//TEST(compute):COMPARE_COMPUTE:
//TEST(compute):COMPARE_COMPUTE:-cpu

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=block0.buffer
//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):name=block1.buffer

// Ensure that Slang `ParameterBlock` type is lowered
// to HLSL in the fashion that we expect.

struct P
{
	RWStructuredBuffer<int> buffer;
};

ParameterBlock<P> block0;
ParameterBlock<P> block1;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
	uint tid = dispatchThreadID.x;

	int inVal = block1.buffer[tid];

	int outVal = inVal;

	block0.buffer[tid] = outVal;
}
back to top