src/common/matrix_utils.h


Log

Author Commit Date CI Message
Tom Sepez a02670d6 2025-08-26T20:41:16 Move unsafe buffers inside header guard macros While this is exactly opposite of what Chromium has chosen to do, there is an issue with clang-format trying to indent preprocessor directives four spaces relative to include guard. This is because Angle's .clang-format file specifies IndentPPDirectives: AfterHash but Chromium's does not. The current placement is sufficient to throw off clang-format's guard detection since the guard macro no longer covers the entire file. Bug: b/436880895 Change-Id: Ic6b99c8cef6213939cdf9b42af8730e1eb423065 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6885892 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Auto-Submit: Tom Sepez <tsepez@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Tom Sepez 25390156 2025-08-21T00:13:19 Suppress unsafe buffers on a file-by-file basis in src/ [1 of N] In this CL, we suppress many files but stop short of actually enabling the warning by not removing the line from the unsafe_buffers_paths.txt file. That will happen in a follow-on CL, along with resolving any stragglers missed here. This is mostly a manual change so as to familiarize myself with the kinds of issues faced by the Angle codebase when applying buffer safety warnings. -- Re-generate affected hashes. -- Clang-format applied to all changed files. -- Add a few missing .reserve() calls to vectors as noticed. -- Fix some mismatches between file names and header comments. -- Be more consistent with header comment format (blank lines and trailing //-only lines when a filename comment adjoins license boilerplate). Bug: b/436880895 Change-Id: I3bde5cc2059acbe8345057289214f1a26f1c34aa Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6869022 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Roman Lavrov c9955641 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>
Jamie Madill bd4e756a 2020-02-17T09:49:45 Const-ify the validation layer. Enforces that the validation layers should be working pretty much read- only with the exeption of updating caches. Requires a few tricks: - updates EP code generation to add 'const' to pointer parameters - enables a kludge const_cast to enable the robust query extension - makes some members of Framebuffer mutable to work around syncState - makes 'is' queries and other methods in Context/State const Will allow us to more safely expose the no_error extension. Bug: angleproject:1280 Change-Id: Id9756757854c9e68fc096ecec8d93759fbe6b3a4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2060689 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jiacheng Lu 73e5e9b5 2019-07-22T15:26:17 Clang warn implicit float to int conversion 1. add '-Wfloat-conversion' in compiler flag for clang 2. fix existed implicit float conversion Bug: angleproject:3728 Change-Id: I0dc07eeb74c5d6dc480c6f0aa88bc75ab98e4292 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1713741 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 2b35654d 2018-12-20T12:43:37 compiler: Fix const non-square matrix component mult. It seems like there weren't any dEQP tests for constant folding of nonsquare matrices component-wise multiplication. There were a couple bugs in our implementation which could lead to undefined behaviour. Fixes the code and cleans up a few style issues. Also includes a regression test. Bug: chromium:912505 Bug: chromium:912508 Change-Id: I7fb85d1404a32950fa9fe4c3bbba9edc9f38ddd1 Reviewed-on: https://chromium-review.googlesource.com/c/1387065 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Jamie Madill b980c563 2018-11-27T11:34:27 Reformat all cpp and h files. This applies git cl format --full to all ANGLE sources. Bug: angleproject:2986 Change-Id: Ib504e618c1589332a37e97696cdc3515d739308f Reviewed-on: https://chromium-review.googlesource.com/c/1351367 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Lingfeng Yang 3a41af64 2018-04-09T07:28:56 GLES1: glLoadIdentity / glLoadMatrix(f|x) BUG=angleproject:2306 Change-Id: I46fe961e6eb87b2f41c39afe1e943d9146a0abfa Reviewed-on: https://chromium-review.googlesource.com/1002913 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jeff Gilbert ad661940 2018-02-22T18:15:45 Remove unused include of math.h in matrix_utils.h. BUG=angleproject:2366 Change-Id: Ic398da0b86caef577140808a87fcc2e74ed28dc0 Reviewed-on: https://chromium-review.googlesource.com/935144 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Lingfeng Yang 710aa5c7 2018-02-08T10:57:55 GLES1: Mat4 transform library GLES1 has functions like glFrustum / glTranslatef which are baked 4x4 matrix operations. The purpose of this CL is to add those operations as library functions in ANGLE, to make it convenient later on. This is inspired by GLM and tested against GLM-generated numbers. BUG=angleproject:2306 Change-Id: I3b428a115a935ee4f0d00585ad38745a38cc128c Reviewed-on: https://chromium-review.googlesource.com/909578 Commit-Queue: Lingfeng Yang <lfy@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Sami Väisänen e45e53bd 2016-05-25T10:36:04 Support CHROMIUM_path_rendering This is partial support for CHROMIUM_path_rendering and implements basic path management and non-instanced rendering. BUG=angleproject:1382 Change-Id: I9c0e88183e0a915d522889323933439d25b45b5f Reviewed-on: https://chromium-review.googlesource.com/348630 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Cooper Partin 4d61f7ed 2015-08-12T10:56:50 Reland Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data' Additional warnings found with more testing and added C4267 warning disable only for angle_libpng BUG=angleproject:1120 Change-Id: Ic403dcff5a8018056fa51a8c408e64207f3362eb Reviewed-on: https://chromium-review.googlesource.com/293028 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill b195643c 2015-08-12T17:35:20 Revert "Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data'" Seems to have quite a few warnings in 64-bit on my machine. BUG=angleproject:1120 This reverts commit c5cf9bc47d0ee028adbbf9e9f94ca567eec601dc. Change-Id: I86768b900aeba52e7a2242d9ae8949f93f1a5ba9 Reviewed-on: https://chromium-review.googlesource.com/293280 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Cooper Partin c5cf9bc4 2015-08-06T10:46:48 Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data' BUG=angleproject:1120 Change-Id: I01ef10bea7f487c2b394d030c76628f38d2ea645 Reviewed-on: https://chromium-review.googlesource.com/292780 Tested-by: Cooper Partin <coopp@microsoft.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Arun Patole 7fa3355f 2015-06-10T15:15:18 Add constant folding support for matrix built-ins This change adds constant folding support for following matrix built-ins: - matrixCompMult, outerProduct, transpose, determinant and inverse. BUG=angleproject:913 TEST=angle_unittests(new: MatrixUtilsTest, ConstantFoldingTest.*Matrix*), dEQP Tests: dEQP-GLES3.functional.shaders.constant_expressions.builtin_functions.matrix.* (All 54 tests started passing with this change) Change-Id: I7b9bf04b9a2cbff72c48216cab04df58c5f008d6 Reviewed-on: https://chromium-review.googlesource.com/276574 Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Tested-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>