summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/array-size-static-const.hlsl14
-rw-r--r--tests/bugs/empty.slang5
-rw-r--r--tests/bugs/implicit-conversion-binary-op.hlsl16
-rw-r--r--tests/bugs/import-overload-error.hlsl19
-rw-r--r--tests/bugs/import-overload-error.slang4
-rw-r--r--tests/bugs/uav-write-index.hlsl31
-rw-r--r--tests/bugs/vec-init-list.hlsl19
7 files changed, 108 insertions, 0 deletions
diff --git a/tests/bugs/array-size-static-const.hlsl b/tests/bugs/array-size-static-const.hlsl
new file mode 100644
index 000000000..fe15d402d
--- /dev/null
+++ b/tests/bugs/array-size-static-const.hlsl
@@ -0,0 +1,14 @@
+// array-size-static-const.hlsl
+//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly
+
+// The bug in this case is that were have a (hidden)
+// cast from the `uint` constant to `int` to get
+// the size of the array, and this cast was tripping
+// up the constant-folding logic.
+
+static const uint n = 16;
+groupshared float b[n];
+
+[numthreads(1,1,1)]
+void main()
+{}
diff --git a/tests/bugs/empty.slang b/tests/bugs/empty.slang
new file mode 100644
index 000000000..ac4b3b7ca
--- /dev/null
+++ b/tests/bugs/empty.slang
@@ -0,0 +1,5 @@
+//TEST_IGNORE_FILE:
+// empty.slang
+
+// This is just an empty file so that tets
+// that need to `__import` something can.
diff --git a/tests/bugs/implicit-conversion-binary-op.hlsl b/tests/bugs/implicit-conversion-binary-op.hlsl
new file mode 100644
index 000000000..75ff737da
--- /dev/null
+++ b/tests/bugs/implicit-conversion-binary-op.hlsl
@@ -0,0 +1,16 @@
+// implicit-conversion-binary-op.hlsl
+//TEST:COMPARE_HLSL: -profile ps_5_0 -target dxbc-assembly
+
+// Make sure that we can pick resolve the right overload
+// to call when applying a binary operator to vectors
+// with different element types. We should pick
+// the "better" of the two element types, and not
+// get an ambiguity error.
+
+float4 main(
+ float4 a : A,
+ uint4 b : B
+ ) : SV_Target
+{
+ return a * b;
+}
diff --git a/tests/bugs/import-overload-error.hlsl b/tests/bugs/import-overload-error.hlsl
new file mode 100644
index 000000000..328bb5b26
--- /dev/null
+++ b/tests/bugs/import-overload-error.hlsl
@@ -0,0 +1,19 @@
+//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking
+
+#ifdef __SLANG__
+__import import_overload_error;
+#else
+
+void foo(int a) {}
+void foo(float b) {}
+
+#endif
+
+void main()
+{
+// Note(tfoley): futzing around with tokens to
+// make sure error message gets reported at a
+// consistent location between languages.
+int a;
+foo();
+}
diff --git a/tests/bugs/import-overload-error.slang b/tests/bugs/import-overload-error.slang
new file mode 100644
index 000000000..e52ce78bb
--- /dev/null
+++ b/tests/bugs/import-overload-error.slang
@@ -0,0 +1,4 @@
+//TEST_IGNORE_FILE:
+
+void foo(int a) {}
+void foo(float b) {}
diff --git a/tests/bugs/uav-write-index.hlsl b/tests/bugs/uav-write-index.hlsl
new file mode 100644
index 000000000..667c73e89
--- /dev/null
+++ b/tests/bugs/uav-write-index.hlsl
@@ -0,0 +1,31 @@
+//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking
+
+// Make sure we handle complex UAV write patterns
+
+// Force import of Slang to ensure that some
+// checking takes place:
+#ifdef __SLANG__
+__import empty;
+#endif
+
+struct Bar
+{
+ uint bar;
+};
+
+RWStructuredBuffer<Bar> gUAV : register(u0);
+
+void foo(RWTexture1D<float2> uav)
+{
+ uint index = gUAV.IncrementCounter();
+ gUAV[index].bar = 1;
+ uav[index] = float2(0,0);
+}
+
+RWTexture1D<float2> gUAV2 : register(u1);
+
+[numthreads(1,1,1)]
+void main()
+{
+ foo(gUAV2);
+}
diff --git a/tests/bugs/vec-init-list.hlsl b/tests/bugs/vec-init-list.hlsl
new file mode 100644
index 000000000..be1bc5c6f
--- /dev/null
+++ b/tests/bugs/vec-init-list.hlsl
@@ -0,0 +1,19 @@
+//TEST:COMPARE_HLSL: -profile vs_5_0 -target dxbc-assembly
+
+// Check handling of initializer list for vector
+
+cbuffer C : register(b0)
+{
+ float4 a;
+};
+
+float w0(float x) { return x; }
+float w1(float x) { return x; }
+float w2(float x) { return x; }
+float w3(float x) { return x; }
+
+float4 main() : SV_Position
+{
+ float4 wx = { w0(a.x), w1(a.x), w2(a.x), w3(a.x), };
+ return wx;
+}