Hash :
c9955641
Author :
Date :
2023-09-25T14:31:01
Avoid malloc in angle::Mat4 by using array instead of vector angle::Matrix<float>::inverse() showed up in cpu profile of "minetest" trace at ~10%. It's a gles1 trace. Multiple objects are constructed and require malloc due to the use of std::vector. Called here: https://crsrc.org/c/third_party/angle/src/libANGLE/GLES1Renderer.cpp;drc=eb0d59973d21f845b5785563f5d56b8ebb617478;l=371 This CL decouples Mat4 from angle::Matrix (some of the functionality had to be copied over) to switch from std::vector to std::array. Testing "minetest" on a phone I saw a ~20% cpu power improvement due to this CL. There is an existing unit test coverage: MatrixUtilsTest.Mat4InvTr Moved 4x4 cofactor matrix code to a helper with transposition included Bug: b/301977186 Change-Id: I1e4c2201d19759dd37c0fee44fb44f4d24a58a6b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4885501 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Roman Lavrov <romanl@google.com>