summaryrefslogtreecommitdiff
path: root/tests/compute/parameter-block.slang
blob: 8c1675405b5ef4caa9974be2238febda8d677f73 (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):dxbinding(0),glbinding(0),out,name=block0.buffer
//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(1),glbinding(1),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;
}