summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/bool-init.slang31
-rw-r--r--tests/bugs/bool-init.slang.expected.txt4
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/bugs/bool-init.slang b/tests/bugs/bool-init.slang
new file mode 100644
index 000000000..95b577c33
--- /dev/null
+++ b/tests/bugs/bool-init.slang
@@ -0,0 +1,31 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute
+
+struct Thing
+{
+ bool a;
+ bool b;
+};
+
+//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)
+{
+ Thing thing = {};
+ int index = int(dispatchThreadID.x);
+
+ if (index % 3)
+ {
+ thing.a = (index & 1) != 0;
+ }
+ else
+ {
+ thing.b = (index & 2) != 0;
+ }
+
+ int v = (thing.a ? 2 : 0) + (thing.b ? 1: 0);
+
+ outputBuffer[index] = v;
+} \ No newline at end of file
diff --git a/tests/bugs/bool-init.slang.expected.txt b/tests/bugs/bool-init.slang.expected.txt
new file mode 100644
index 000000000..96d2eb1bf
--- /dev/null
+++ b/tests/bugs/bool-init.slang.expected.txt
@@ -0,0 +1,4 @@
+0
+2
+0
+1