Issue 8691 in angleproject: Metal: Rewrite constant initializers containing matrices

2 views
Skip to first unread message

lexa.… via monorail

unread,
May 8, 2024, 2:41:01 PM5/8/24
to angleproj...@googlegroups.com
Status: Available
Owner: ----
CC: k...@chromium.org, geoff...@chromium.org, kpidd...@apple.com
Components: Translator
OS: Mac iOS
Priority: Medium
Renderer: Metal
Type: Defect

New issue 8691 by lexa....@gmail.com: Metal: Rewrite constant initializers containing matrices
https://bugs.chromium.org/p/angleproject/issues/detail?id=8691

Metal shaders fail to compile when a constant array or struct initializer contains matrix variables.

For example, the following snippet fails:

constant metal::float4x4 m0 = metal::float4x4(1.0f);
constant metal::array<metal::float4x4, 1> m_arr = {m0};

This could be worked around by replacing matrix variables in initializers with matrix constructors using columns of the original variable like this:

constant metal::array<metal::float4x4, 1> m_arr = {
metal::float4x4(m0[0], m0[1], m0[2], m0[3])
};

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

Git Watcher via monorail

unread,
May 13, 2024, 12:26:10 PM5/13/24
to angleproj...@googlegroups.com

Comment #1 on issue 8691 by Git Watcher: Metal: Rewrite constant initializers containing matrices
https://bugs.chromium.org/p/angleproject/issues/detail?id=8691#c1

The following revision refers to this bug:
https://chromium.googlesource.com/angle/angle/+/82ddb33b583adfa5338369bef07150c1180fd3e4

commit 82ddb33b583adfa5338369bef07150c1180fd3e4
Author: Alexey Knyazev <lexa.k...@gmail.com>
Date: Fri May 10 00:00:00 2024

Metal: Do not separate vector and matrix constants

Do not create temporary variables for already
folded constant vector and matrix values.

This reduces register usage and partially fixes
MSL compilation errors caused by matrices
present in constant initializers.

Bug: angleproject:8691
Change-Id: Iedfabadd9b7bcb2e6e1e08a5ad39f48305365747
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5533925
Reviewed-by: Kimmo Kinnunen <kkin...@apple.com>
Commit-Queue: Alexey Knyazev <lexa.k...@gmail.com>
Reviewed-by: Geoff Lang <geof...@chromium.org>

[modify] https://crrev.com/82ddb33b583adfa5338369bef07150c1180fd3e4/src/compiler/translator/tree_ops/msl/SeparateCompoundExpressions.cpp
[modify] https://crrev.com/82ddb33b583adfa5338369bef07150c1180fd3e4/src/tests/gl_tests/GLSLTest.cpp
Reply all
Reply to author
Forward
0 new messages