summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-471.slang
blob: e48c1da5a4a1b3005f11e98b071f712d29b819d1 (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 -xslang -Wno-41024
//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;

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