summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/link-time-constant-array-size-lib.slang1
-rw-r--r--tests/bugs/link-time-constant-array-size-main.slang22
-rw-r--r--tests/library/ambiguous-extern-export-entry.slang.expected17
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/bugs/link-time-constant-array-size-lib.slang b/tests/bugs/link-time-constant-array-size-lib.slang
new file mode 100644
index 000000000..cc83c30fa
--- /dev/null
+++ b/tests/bugs/link-time-constant-array-size-lib.slang
@@ -0,0 +1 @@
+export static const int N = 1597463007;
diff --git a/tests/bugs/link-time-constant-array-size-main.slang b/tests/bugs/link-time-constant-array-size-main.slang
new file mode 100644
index 000000000..da58decaf
--- /dev/null
+++ b/tests/bugs/link-time-constant-array-size-main.slang
@@ -0,0 +1,22 @@
+//TEST:COMPILE: tests/bugs/link-time-constant-array-size-lib.slang -o tests/bugs/link-time-constant-array-size-lib.slang-module
+//TEST:COMPILE: tests/bugs/link-time-constant-array-size-main.slang -o tests/bugs/link-time-constant-array-size-main.slang-module
+//TEST:SIMPLE(filecheck=SPIRV): -r tests/bugs/link-time-constant-array-size-main.slang-module -r tests/bugs/link-time-constant-array-size-lib.slang-module -target spirv -o out.spv -stage compute -entry computeMain
+
+extern static const int N;
+
+// SPIRV: ([[# @LINE+1]]): warning 31000
+struct S { int xs[N]; }
+
+RWStructuredBuffer<S> b;
+
+ParameterBlock<S> p;
+
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ // check that we multiply by our special number
+ // SPIRV: [[fisqr:%[a-zA-Z0-9_]+]] = OpConstant %int 1597463007
+ // SPIRV: {{%[0-9]+}} = OpIMul %int {{%[0-9]+}} [[fisqr]]
+ for(int i = 0; i < N; ++i)
+ b[0].xs[i] = p.xs[i] * N;
+}
diff --git a/tests/library/ambiguous-extern-export-entry.slang.expected b/tests/library/ambiguous-extern-export-entry.slang.expected
new file mode 100644
index 000000000..4ee9ac6c5
--- /dev/null
+++ b/tests/library/ambiguous-extern-export-entry.slang.expected
@@ -0,0 +1,17 @@
+result code = 0
+standard error = {
+tests/library/ambiguous-extern-export-lib1.slang(4): warning 31000: Link-time constant sized arrays are a work in progress feature, some aspects of the reflection API may not work
+public extern static const int[call_data_len] call_group_vector;
+ ^~~~~~~~~~~~~~~~~
+tests/library/ambiguous-extern-export-lib1.slang(5): warning 31000: Link-time constant sized arrays are a work in progress feature, some aspects of the reflection API may not work
+public static int[call_data_len] call_id_1 = {};
+ ^~~~~~~~~
+tests/library/ambiguous-extern-export-lib2.slang(5): warning 31000: Link-time constant sized arrays are a work in progress feature, some aspects of the reflection API may not work
+public extern static const int[call_data_len] call_group_vector;
+ ^~~~~~~~~~~~~~~~~
+tests/library/ambiguous-extern-export-lib2.slang(7): warning 31000: Link-time constant sized arrays are a work in progress feature, some aspects of the reflection API may not work
+public static int[call_data_len] call_id_2 = {};
+ ^~~~~~~~~
+}
+standard output = {
+}