summaryrefslogtreecommitdiffstats
path: root/tests/bugs/bool-init.slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-11-08 18:52:15 -0500
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-11-08 15:52:15 -0800
commit6ee483dc6ddbd372fb509319e0b70f7fc6152278 (patch)
treea631abf02ae0faa01232236e8d6b2bb06d8f9859 /tests/bugs/bool-init.slang
parent0ac010a72e777b2c284583fcb8554abee83d8ff5 (diff)
Fix problem when getting default value for a bool, was producing 0, which on glsl could not be coerced. (#1117)
Diffstat (limited to 'tests/bugs/bool-init.slang')
-rw-r--r--tests/bugs/bool-init.slang31
1 files changed, 31 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