From 260ff7ae233b90ba3ae12ffd7284201e2ca667f9 Mon Sep 17 00:00:00 2001 From: Xianzhu Wang Date: Thu, 10 Nov 2022 12:45:17 -0800 Subject: [PATCH] Optimize some 2d full matrix operations in gfx::Transform There are two purposes: 1. To improve performance of 2d full matrix operations. Though full matrices are rare, some special apps (e.g. motionmark) use full 2d matrices heavily. This CL can improve motionmark CanvasLine Leaves and Multiply by about 1% (https://pinpoint-dot-chromeperf.appspot.com/job/112ba12e5a0000). 2. To ensure 2d preservation in Inverse and Concat operations. Bug: 1359528 Change-Id: Iab03df64166d8105e18652e2872fa1b34837f284 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4017954 Reviewed-by: David Baron Commit-Queue: Xianzhu Wang Owners-Override: Xianzhu Wang Cr-Commit-Position: refs/heads/main@{#1069953} --- webxr/xrSession_viewer_referenceSpace.https.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webxr/xrSession_viewer_referenceSpace.https.html b/webxr/xrSession_viewer_referenceSpace.https.html index 0098d4d918daf2..1768c9684978a2 100644 --- a/webxr/xrSession_viewer_referenceSpace.https.html +++ b/webxr/xrSession_viewer_referenceSpace.https.html @@ -30,7 +30,9 @@ assert_not_equals(poseMatrix, null); for(let i = 0; i < poseMatrix.length; i++) { - assert_equals(poseMatrix[i], IDENTITY_MATRIX[i]); + // "0 +" is to accept -0 which is equivalent to 0 in the + // matrix. + assert_equals(0 + poseMatrix[i], IDENTITY_MATRIX[i]); } fakeDeviceController.setViewerOrigin(VALID_POSE_TRANSFORM); @@ -46,7 +48,9 @@ assert_not_equals(poseMatrix, null); for(let i = 0; i < poseMatrix.length; i++) { - assert_equals(poseMatrix[i], IDENTITY_MATRIX[i]); + // "0 +" is to accept -0 which is equivalent to 0 in the + // matrix. + assert_equals(0 + poseMatrix[i], IDENTITY_MATRIX[i]); } });