summaryrefslogtreecommitdiff
path: root/tests/bugs
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2019-01-30 17:25:09 -0800
committerGitHub <noreply@github.com>2019-01-30 17:25:09 -0800
commit4db0aba1edc5fd55b91457481bae119ef66dde89 (patch)
tree9a3153d2749b733ad82563bebbc4aa2d2c0ca126 /tests/bugs
parentdc018032ee82911030601fa1cd3ca39ca107ad44 (diff)
parentc6e5551f6cf38caa37f4ebb6415e97c86eece241 (diff)
Merge pull request #818 from csyonghe/fix-while-in-gen
Fixing IR-lowering not properly registering func decl
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/while-in-generic.slang23
-rw-r--r--tests/bugs/while-in-generic.slang.expected.txt4
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/bugs/while-in-generic.slang b/tests/bugs/while-in-generic.slang
new file mode 100644
index 000000000..ea34238f5
--- /dev/null
+++ b/tests/bugs/while-in-generic.slang
@@ -0,0 +1,23 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+struct Context
+{
+ int genFunc<TGenType>(TGenType t)
+ {
+ int i = 0;
+ while (true)
+ {
+ i++;
+ if (i > 5) break;
+ }
+ return i;
+ }
+};
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ Context c;
+ outputBuffer[dispatchThreadID.x] = c.genFunc<int>(5);
+} \ No newline at end of file
diff --git a/tests/bugs/while-in-generic.slang.expected.txt b/tests/bugs/while-in-generic.slang.expected.txt
new file mode 100644
index 000000000..4c6d5911b
--- /dev/null
+++ b/tests/bugs/while-in-generic.slang.expected.txt
@@ -0,0 +1,4 @@
+6
+6
+6
+6 \ No newline at end of file