diff options
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/gh-471.slang | 34 | ||||
| -rw-r--r-- | tests/bugs/gh-471.slang.expected.txt | 4 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/bugs/gh-471.slang b/tests/bugs/gh-471.slang new file mode 100644 index 000000000..d7123bb4e --- /dev/null +++ b/tests/bugs/gh-471.slang @@ -0,0 +1,34 @@ +//TEST(compute):COMPARE_COMPUTE: +//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(0),glbinding(0),out + +// 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; +}
\ No newline at end of file diff --git a/tests/bugs/gh-471.slang.expected.txt b/tests/bugs/gh-471.slang.expected.txt new file mode 100644 index 000000000..39da7d1a9 --- /dev/null +++ b/tests/bugs/gh-471.slang.expected.txt @@ -0,0 +1,4 @@ +0 +10 +20 +30 |
