summaryrefslogtreecommitdiff
path: root/tests/language-feature
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-09-05 10:26:59 -0700
committerGitHub <noreply@github.com>2024-09-05 10:26:59 -0700
commita88055c6f5190ca62bb4aa853b4f0fa11546278f (patch)
tree0f4a417153110d43cf361c0abe29c8996b806f3c /tests/language-feature
parent959f55de964ff108947db72a3f8d25b39995f2c8 (diff)
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 <yhe@nvidia.com>
Diffstat (limited to 'tests/language-feature')
-rw-r--r--tests/language-feature/types/matrix-layout-uniform.slang19
1 files changed, 19 insertions, 0 deletions
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