summaryrefslogtreecommitdiffstats
path: root/tests/current-bugs
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-04-26 16:15:54 -0400
committerGitHub <noreply@github.com>2021-04-26 16:15:54 -0400
commit599129dea6930cf64a403e5e0dbd7cc7293df8af (patch)
tree7804f13206203c0efb2b0e5f99924841a55e76c8 /tests/current-bugs
parentb17701c489ce729d255675d04dc2fff58ac18752 (diff)
Matrix tests and assorted bug tests (#1814)
* #include an absolute path didn't work - because paths were taken to always be relative. * Some test around matrix layout. * A test for problem with C++ code output. * Default should be column major CPU/CUDA tests confused this. * Added column-major test * Small fixes around tabs/comments * Diagnostic problem for init of vector type with inappropriate params. * Test demonstrating inconsistency between GPU and 'CPU-like' non square matrices. * Added column major non square test. * Remove vector mismatch - because ambiguity is arguably reasonable because float can silently promote to a vector. * Small typo fixes for non-square-column-major.slang
Diffstat (limited to 'tests/current-bugs')
-rw-r--r--tests/current-bugs/cpp-resource-issue.slang40
-rw-r--r--tests/current-bugs/missing-loc-on-assignment.slang25
-rw-r--r--tests/current-bugs/missing-loc-on-assignment.slang.expected6
3 files changed, 71 insertions, 0 deletions
diff --git a/tests/current-bugs/cpp-resource-issue.slang b/tests/current-bugs/cpp-resource-issue.slang
new file mode 100644
index 000000000..13906ba95
--- /dev/null
+++ b/tests/current-bugs/cpp-resource-issue.slang
@@ -0,0 +1,40 @@
+// cpu-resource-issue.slang
+
+// Enable this test - and cpu C++ compilation of output fails.
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -compile-arg -O3 -xslang -matrix-layout-column-major -shaderobj
+
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -compile-arg -O3 -xslang -matrix-layout-column-major -shaderobj
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -xslang -matrix-layout-column-major -shaderobj
+//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -dx12 -xslang -matrix-layout-column-major -shaderobj
+//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -xslang -matrix-layout-column-major -shaderobj
+
+//TEST_INPUT:cbuffer(data=[1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 10.0 20.0 30.0 1.0]):name matrixBuffer
+ConstantBuffer<float4x4> matrixBuffer;
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name rowOrderMatrixOutput
+RWStructuredBuffer<float> rowOrderMatrixOutput;
+
+void writeRow(float4 v, int rowIndex)
+{
+ int baseIndex = rowIndex * 4;
+
+ rowOrderMatrixOutput[baseIndex + 0] = v.x;
+ rowOrderMatrixOutput[baseIndex + 1] = v.y;
+ rowOrderMatrixOutput[baseIndex + 2] = v.z;
+ rowOrderMatrixOutput[baseIndex + 3] = v.w;
+}
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 tid : SV_DispatchThreadID)
+{
+ float4 v = float4(1, 2, 3, 1);
+
+ float4x4 M = matrixBuffer;
+
+ float4 r = mul(v, M);
+
+ writeRow(M[0], 0);
+ writeRow(M[1], 1);
+ writeRow(M[2], 2);
+ writeRow(M[3], 3);
+}
diff --git a/tests/current-bugs/missing-loc-on-assignment.slang b/tests/current-bugs/missing-loc-on-assignment.slang
new file mode 100644
index 000000000..97b29b301
--- /dev/null
+++ b/tests/current-bugs/missing-loc-on-assignment.slang
@@ -0,0 +1,25 @@
+// missing-loc-on-assignment.slang
+
+//DIAGNOSTIC_TEST:SIMPLE:-target hlsl -stage compute -entry computeMain
+
+//TEST_INPUT:cbuffer(data=[1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 10.0 20.0 30.0 1.0]):name matrixBuffer
+ConstantBuffer<float4x4> matrixBuffer;
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name output
+RWStructuredBuffer<float> output;
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 tid : SV_DispatchThreadID)
+{
+ float4 v = float4(1, 2, 3, 1);
+
+ // Produces an error but not a location(!)
+ float4 M = matrixBuffer;
+
+ float4 r = mul(v, M);
+
+ output[0] = r.x;
+ output[1] = r.y;
+ output[2] = r.z;
+ output[3] = r.w;
+}
diff --git a/tests/current-bugs/missing-loc-on-assignment.slang.expected b/tests/current-bugs/missing-loc-on-assignment.slang.expected
new file mode 100644
index 000000000..021701be9
--- /dev/null
+++ b/tests/current-bugs/missing-loc-on-assignment.slang.expected
@@ -0,0 +1,6 @@
+result code = -1
+standard error = {
+(0): error 30019: expected an expression of type 'vector<float,4>', got 'matrix<float,4,4>'
+}
+standard output = {
+}