yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

CopilotAdd warning for comma operators used outside for-loops and expand expressions in legacy mode (#7984)9ed7b5264

master
592 B34 linesraw
1//TEST(compute):COMPARE_COMPUTE: -shaderobj -xslang -Wno-41024
2//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):out,name outputBuffer
3
4// Test that "operator comma" works as expected
5
6static int a = 0;
7
8int setA(int val)
9{
10	a = val;
11	return 0;
12}
13
14int getA()
15{
16	return a;
17}
18
19int test(int inVal)
20{
21	int x = (setA(inVal), getA());
22	return x * 16;
23}
24
25RWStructuredBuffer<int> outputBuffer;
26
27[numthreads(4, 1, 1)]
28void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
29{
30	uint tid = dispatchThreadID.x;
31	int inVal = outputBuffer[tid];
32	int outVal = test(inVal);
33	outputBuffer[tid] = outVal;
34}