HLSL: add implicit mat*mat truncations

Goes with PR #1161, and completes the space for mul() implicit truncations.

Note that the v*v and scalar cases are already handled by existing code.
This commit is contained in:
LoopDawg
2017-11-27 09:42:53 -07:00
parent 792a94809b
commit cee29b04d6
3 changed files with 619 additions and 345 deletions

View File

@@ -6,6 +6,7 @@ cbuffer Matrix
float4x4 m44;
float4x3 m43;
float3x4 m34;
float3x3 m33;
float2x4 m24;
float4x2 m42;
float4 v4;
@@ -27,11 +28,11 @@ float4 main() : SV_Target0
float4 r20 = mul(m44, v3); // float4 = float4x4 * float3; // clamp mat to float4x3;
float4 r21 = mul(m43, v4); // truncate vector to vec3
// // m*m
// float2x3 r30 = mul(m24, m33); // float2x3 = float2x4 * float3x3;
// float3x4 r31 = mul(m33, m24); // float3x4 = float3x3 * float2x4;
// float3x2 r32 = mul(m33, m42); // float3x2 = float3x3 * float4x2;
// float4x3 r33 = mul(m42, m33); // float4x3 = float4x2 * float3x3;
// m*m
float2x3 r30 = mul(m24, m33); // float2x3 = float2x4 * float3x3;
float3x4 r31 = mul(m33, m24); // float3x4 = float3x3 * float2x4;
float3x2 r32 = mul(m33, m42); // float3x2 = float3x3 * float4x2;
float4x3 r33 = mul(m42, m33); // float4x3 = float4x2 * float3x3;
return r10 + r11 + r20 + r21 + r00 + r01; // + r30[0].x + r31[0] + r32[0].x + transpose(r33)[0];
return r10 + r11 + r20 + r21 + r00 + r01 + r30[0].x + r31[0] + r32[0].x + transpose(r33)[0];
}