From 7b4e0e1892bad9f51677b191c69b01aee7403632 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 23 Mar 2020 17:55:49 -0400 Subject: First pass at a Target Compatibility document (#1287) * WIP compatibility docs. * Test transpose in matrix-float. * Small improvement to CUDA docs. * Added some discussion around tessellation. * Small improvements to target-compatibility.md * Improve compatibility documentation. Co-authored-by: Tim Foley --- tests/hlsl-intrinsic/matrix-float.slang | 16 ++++++---------- tests/hlsl-intrinsic/matrix-float.slang.expected.txt | 8 ++++---- 2 files changed, 10 insertions(+), 14 deletions(-) (limited to 'tests') 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 IntMatrix; typedef matrix UIntMatrix; typedef vector FloatVector; -float calcTotal(vector 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 -- cgit v1.2.3