diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/gh-841.slang.glsl | 3 | ||||
| -rw-r--r-- | tests/bugs/ssa-loop.slang | 31 | ||||
| -rw-r--r-- | tests/bugs/ssa-loop.slang.expected.txt | 4 | ||||
| -rw-r--r-- | tests/compute/unbounded-array-of-array-syntax.slang.glsl | 7 | ||||
| -rw-r--r-- | tests/cross-compile/geometry-shader.slang.glsl | 3 | ||||
| -rw-r--r-- | tests/cross-compile/precise-keyword.slang.glsl | 6 |
6 files changed, 47 insertions, 7 deletions
diff --git a/tests/bugs/gh-841.slang.glsl b/tests/bugs/gh-841.slang.glsl index caee80928..ab223724f 100644 --- a/tests/bugs/gh-841.slang.glsl +++ b/tests/bugs/gh-841.slang.glsl @@ -24,7 +24,8 @@ void main() if(bool(_S4.u_0 & uint(1))) { - result_0 = result_1 + 1.0; + vec4 _S5 = result_1 + 1.0; + result_0 = _S5; } else { diff --git a/tests/bugs/ssa-loop.slang b/tests/bugs/ssa-loop.slang new file mode 100644 index 000000000..722c40d98 --- /dev/null +++ b/tests/bugs/ssa-loop.slang @@ -0,0 +1,31 @@ +// ssa-loop.slang + +// Bug related to SSA form for loops + +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute + +int test(int val) +{ + int N = val; + int x = 0; + int y = 1; + for(int i = 0; i < N; ++i) + { + int t = x; + x = y; + y = t; + } + return x*16 + y; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer +RWStructuredBuffer<int> gOutputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + int inputVal = tid; + int outputVal = test(inputVal); + gOutputBuffer[tid] = outputVal; +}
\ No newline at end of file diff --git a/tests/bugs/ssa-loop.slang.expected.txt b/tests/bugs/ssa-loop.slang.expected.txt new file mode 100644 index 000000000..545785096 --- /dev/null +++ b/tests/bugs/ssa-loop.slang.expected.txt @@ -0,0 +1,4 @@ +1 +10 +1 +10 diff --git a/tests/compute/unbounded-array-of-array-syntax.slang.glsl b/tests/compute/unbounded-array-of-array-syntax.slang.glsl index 675d00718..d9d0f6262 100644 --- a/tests/compute/unbounded-array-of-array-syntax.slang.glsl +++ b/tests/compute/unbounded-array-of-array-syntax.slang.glsl @@ -28,13 +28,14 @@ void main() if(uint(innerIndex_1) >= bufferCount_0) { - innerIndex_0 = int(bufferCount_0 - uint(1)); + int _S5 = int(bufferCount_0 - uint(1)); + innerIndex_0 = _S5; } else { innerIndex_0 = innerIndex_1; } - uint _S5 = uint(innerIndex_0); - ((outputBuffer_0)._data[(uint(index_0))]) = ((g_aoa_0[nonuniformEXT(index_0 >> 2)])._data[(_S5)]); + uint _S6 = uint(innerIndex_0); + ((outputBuffer_0)._data[(uint(index_0))]) = ((g_aoa_0[nonuniformEXT(index_0 >> 2)])._data[(_S6)]); return; } diff --git a/tests/cross-compile/geometry-shader.slang.glsl b/tests/cross-compile/geometry-shader.slang.glsl index 2dd9d35bc..feaf3e1f2 100644 --- a/tests/cross-compile/geometry-shader.slang.glsl +++ b/tests/cross-compile/geometry-shader.slang.glsl @@ -91,7 +91,8 @@ void main() EmitVertex(); - ii_0 = ii_0 + 1; + int _S9 = ii_0 + 1; + ii_0 = _S9; } return; diff --git a/tests/cross-compile/precise-keyword.slang.glsl b/tests/cross-compile/precise-keyword.slang.glsl index be541ff94..1aabaa1b3 100644 --- a/tests/cross-compile/precise-keyword.slang.glsl +++ b/tests/cross-compile/precise-keyword.slang.glsl @@ -15,11 +15,13 @@ void main() if(_S2.x > float(0)) { - z_0 = _S2.x * _S2.y + _S2.x; + float _S3 = _S2.x * _S2.y + _S2.x; + z_0 = _S3; } else { - z_0 = _S2.y * _S2.x + _S2.y; + float _S4 = _S2.y * _S2.x + _S2.y; + z_0 = _S4; } _S1 = vec4(z_0); return; |
