summaryrefslogtreecommitdiff
path: root/tests/bugs/gh-471.slang
blob: e7b09760be319c9d47aa77ae717854aee9f09db8 (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
29
30
31
32
33
34
//TEST(compute):COMPARE_COMPUTE: -shaderobj
//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):out,name outputBuffer

// Test that "operator comma" works as expected

static int a = 0;

int setA(int val)
{
	a = val;
	return 0;
}

int getA()
{
	return a;
}

int test(int inVal)
{
	int x = (setA(inVal), getA());
	return x * 16;
}

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;
}