summaryrefslogtreecommitdiff
path: root/tests/compute/parameter-block.slang
blob: a6424134c1dbfff6f1b2e05d3eef36cda6162578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//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;
}