summaryrefslogtreecommitdiff
path: root/tests/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/gh-841.slang.glsl3
-rw-r--r--tests/bugs/ssa-loop.slang31
-rw-r--r--tests/bugs/ssa-loop.slang.expected.txt4
3 files changed, 37 insertions, 1 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