From a88055c6f5190ca62bb4aa853b4f0fa11546278f Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 5 Sep 2024 10:26:59 -0700 Subject: Respect matrix layout in uniform and in/out parameters for HLSL target. (#5013) * Respect matrix layout in uniform and in/out parameters for HLSL target. * Update test. * Fix test. * fix test. * Fix metal layout calculation. * Fix compile error. * Fix compiler error. --------- Co-authored-by: Yong He --- .../types/matrix-layout-uniform.slang | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/language-feature/types/matrix-layout-uniform.slang (limited to 'tests/language-feature') diff --git a/tests/language-feature/types/matrix-layout-uniform.slang b/tests/language-feature/types/matrix-layout-uniform.slang new file mode 100644 index 000000000..ed72ccdca --- /dev/null +++ b/tests/language-feature/types/matrix-layout-uniform.slang @@ -0,0 +1,19 @@ +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -profile vs_6_0 -entry Main + +// HLSL: #pragma pack_matrix(column_major) +// HLSL-NOT: row_major float4x4 worldToClip +// HLSL: row_major float4x4 instanceMeshToWorld + +[shader("vertex")] +void Main( + uniform column_major float4x4 worldToClip, + out float4 SV_Position : SV_Position, + in row_major float4x4 instanceMeshToWorld : instanceMeshToWorld, + in float3 vertexPositionInMesh : vertexPositionInMesh +) +{ + SV_Position = mul( + mul(worldToClip, instanceMeshToWorld), + float4(vertexPositionInMesh, 1.f), + ); +} \ No newline at end of file -- cgit v1.2.3