summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hlsl-intrinsic/matrix-float.slang16
-rw-r--r--tests/hlsl-intrinsic/matrix-float.slang.expected.txt8
2 files changed, 10 insertions, 14 deletions
diff --git a/tests/hlsl-intrinsic/matrix-float.slang b/tests/hlsl-intrinsic/matrix-float.slang
index 4d49297a8..4de0517f9 100644
--- a/tests/hlsl-intrinsic/matrix-float.slang
+++ b/tests/hlsl-intrinsic/matrix-float.slang
@@ -1,7 +1,5 @@
// TODO(JS):
// NOTE we can't test on VK/gl at the moment because we don't support intrinsics over matrices on that target currently
-// TODO(JS):
-// Also NOTE, we do not test matrix inverse as currently unsupported on C++/CUDA targets
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type
@@ -17,14 +15,10 @@ typedef matrix<int, 2, 2> IntMatrix;
typedef matrix<uint, 2, 2> UIntMatrix;
typedef vector<float, 2> FloatVector;
-float calcTotal(vector<float, 2> v)
-{
- return v.x + v.y;
-}
-
-float calcTotal(FloatMatrix v)
+float calcResult(FloatMatrix v)
{
- return calcTotal(v[0]) + calcTotal(v[1]);
+ // Multiply diffent parts by different amounts to make order important
+ return v[0][0] + v[0][1] * 2 + v[1][0] * 3 + v[1][1] * 4;
}
FloatMatrix makeFloatMatrix(float f)
@@ -50,6 +44,8 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
FloatMatrix f = { { scalarF + 0.01, scalarF + 0.02f}, { scalarF + 0.011f, scalarF + 0.022f}};
+ ft += transpose(f);
+
// fmod
ft += FloatMatrix(IntMatrix(((f % makeFloatMatrix(0.11f)) * makeFloatMatrix(100)) + makeFloatMatrix(0.5)));
@@ -133,5 +129,5 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
UIntMatrix vu = asuint(f);
ft += asfloat(vu);
- outputBuffer[idx] = calcTotal(ft);
+ outputBuffer[idx] = calcResult(ft);
} \ No newline at end of file
diff --git a/tests/hlsl-intrinsic/matrix-float.slang.expected.txt b/tests/hlsl-intrinsic/matrix-float.slang.expected.txt
index 10941c176..d7c998048 100644
--- a/tests/hlsl-intrinsic/matrix-float.slang.expected.txt
+++ b/tests/hlsl-intrinsic/matrix-float.slang.expected.txt
@@ -1,5 +1,5 @@
type: float
--367.570129
--128.128876
-139.494034
-414.148346
+-916.058716
+-315.978027
+358.120331
+1035.545532