summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-03-16 22:17:51 -0700
committerGitHub <noreply@github.com>2023-03-16 22:17:51 -0700
commit77d3630eef4ea1c4b0424a46526a6be476a89230 (patch)
tree7c097dfcf9ee2b678d3044ffa70fc232c2b3714e /tests
parentfc9cba5307d166f7fda3f7e2c8b5bed7b06fef54 (diff)
Fix name mangling of `FuncCallIntVal` in func signatures. (#2709)
* Fix name mangling of `FuncCallIntVal` in func signatures. * Enhance the test. * Fix. * Fix. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/array-size-static-const-2.slang33
-rw-r--r--tests/bugs/array-size-static-const-2.slang.expected.txt5
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/bugs/array-size-static-const-2.slang b/tests/bugs/array-size-static-const-2.slang
new file mode 100644
index 000000000..f7aa00b97
--- /dev/null
+++ b/tests/bugs/array-size-static-const-2.slang
@@ -0,0 +1,33 @@
+// array-size-static-const-2.hlsl
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<uint> outputBuffer;
+
+interface IA
+{
+ static const int M;
+}
+struct B : IA
+{
+ static const int M = 2;
+}
+struct GenType<T : __BuiltinIntegerType, A: IA, let N : int>
+{
+ static const int HalfN = N > 1? N / A.M : 1;
+ T sum(T arr[HalfN])
+ {
+ T rs = T(0);
+ for (int i = 0; i < HalfN; i++)
+ rs += arr[i];
+ return rs;
+ }
+}
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ int arr[2] = { 1, 2 };
+ GenType<int, B, 4> obj;
+ outputBuffer[0] = obj.sum(arr);
+} \ No newline at end of file
diff --git a/tests/bugs/array-size-static-const-2.slang.expected.txt b/tests/bugs/array-size-static-const-2.slang.expected.txt
new file mode 100644
index 000000000..ae5bfa02a
--- /dev/null
+++ b/tests/bugs/array-size-static-const-2.slang.expected.txt
@@ -0,0 +1,5 @@
+type: uint32_t
+3
+0
+0
+0