summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-06-26 18:11:02 -0400
committerGitHub <noreply@github.com>2023-06-26 15:11:02 -0700
commit7175f647f576a4d613928a87dc7140280df4217f (patch)
tree0d5deab6d9ff79e4223e78f1c7d10c6dc6017318 /tests
parent49389f3a1e14576c95c0163c66554f67fe241ff7 (diff)
Multiple cast issue fix (#2940)
* Small fixes and improvements around reflection tool. * Make PrettyWriter printing a class. * WIP parens casting issue. * Fix issue with multiple casts. * Match previous location point for casting, with 'fast' path. * Removed logic to output the found decl, as not needed to construct ExplicitCastExpr.
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/parens-cast-issue.slang21
-rw-r--r--tests/bugs/parens-cast-issue.slang.expected.txt4
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/bugs/parens-cast-issue.slang b/tests/bugs/parens-cast-issue.slang
new file mode 100644
index 000000000..2cfe603c8
--- /dev/null
+++ b/tests/bugs/parens-cast-issue.slang
@@ -0,0 +1,21 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
+//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ int idx = (int)tid;
+
+ float q = (idx * 0.5);
+
+ int x = (uint)(int)q;
+
+ // This combination of casts and parenthesis used to cause issues.
+ int z = ((uint)(int)q);
+
+ outputBuffer[tid] = z + x;
+} \ No newline at end of file
diff --git a/tests/bugs/parens-cast-issue.slang.expected.txt b/tests/bugs/parens-cast-issue.slang.expected.txt
new file mode 100644
index 000000000..3333a969d
--- /dev/null
+++ b/tests/bugs/parens-cast-issue.slang.expected.txt
@@ -0,0 +1,4 @@
+0
+0
+2
+2