From b253edb1e92791d7ab0134f1ec8edc41c08b719c Mon Sep 17 00:00:00 2001 From: Alexander Cooper Date: Tue, 28 Apr 2020 11:47:56 +0000 Subject: [PATCH] Bug 1633489 [wpt PR 23272] - Treat floorOrigin as mojoFromFloor, a=testonly Automatic update from web-platform-tests Treat floorOrigin as mojoFromFloor Per the webxr-test-api all origins are based on the "local" space when the "session" started; which means that all of our origins passed in are inherently "mojoFromFoo." The standingTransform (in need of renaming) is, in blink and by devices, floorFromMojo. Since the tests were directly setting floorOrigin to the standingTransform, the tests were incorrectly treating floor origin as floorFromMojo. This change inverts the floorOrigin before assigning it to the standingTransform, so that Chrome begins treating the floorOrigin as mojoFromFloor. Given that Chrome was the only ones running these particular tests, the output values were *also* written as if the passed in floorOrigins were floorFromMojo. In order to stick with the expectations, this inverts the input transforms as well. In fixing this, a bug was discovered in XRMathHelper.inverse wherein the comatrix was not created properly. This change also addresses that bug. Fixed:1071630 Change-Id: I1626d80099169c4ceba0df68ad84bbf181f76647 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2165881 Auto-Submit: Alexander Cooper Commit-Queue: Piotr Bialecki Reviewed-by: Piotr Bialecki Cr-Commit-Position: refs/heads/master@{#763104} -- wpt-commits: 6a2f0e6a0110fd0830fc3196680f671bb83c2747 wpt-pr: 23272 --- .../chromium/webxr-test-math-helper.js | 16 ++--- .../tests/resources/chromium/webxr-test.js | 7 ++- ..._hittest_subscription_refSpaces.https.html | 4 +- .../webxr/resources/webxr_test_constants.js | 2 +- ...erenceSpace_originOffsetBounded.https.html | 2 +- .../xrReferenceSpace_relationships.https.html | 59 +++++++++++++++++++ 6 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html diff --git a/testing/web-platform/tests/resources/chromium/webxr-test-math-helper.js b/testing/web-platform/tests/resources/chromium/webxr-test-math-helper.js index 9f10a9d4b7f7..d47fde208dac 100644 --- a/testing/web-platform/tests/resources/chromium/webxr-test-math-helper.js +++ b/testing/web-platform/tests/resources/chromium/webxr-test-math-helper.js @@ -196,23 +196,23 @@ class XRMathHelper { const result2 = [ // First column (m0r): invDet * det3x3(m11, m12, m13, m21, m22, m23, m32, m32, m33), - invDet * det3x3(m10, m12, m13, m20, m22, m23, m30, m32, m33), + -invDet * det3x3(m10, m12, m13, m20, m22, m23, m30, m32, m33), invDet * det3x3(m10, m11, m13, m20, m21, m23, m30, m31, m33), - invDet * det3x3(m10, m11, m12, m20, m21, m22, m30, m31, m32), + -invDet * det3x3(m10, m11, m12, m20, m21, m22, m30, m31, m32), // Second column (m1r): - invDet * det3x3(m01, m02, m03, m21, m22, m23, m32, m32, m33), + -invDet * det3x3(m01, m02, m03, m21, m22, m23, m32, m32, m33), invDet * det3x3(m00, m02, m03, m20, m22, m23, m30, m32, m33), - invDet * det3x3(m00, m01, m03, m20, m21, m23, m30, m31, m33), + -invDet * det3x3(m00, m01, m03, m20, m21, m23, m30, m31, m33), invDet * det3x3(m00, m01, m02, m20, m21, m22, m30, m31, m32), // Third column (m2r): invDet * det3x3(m01, m02, m03, m11, m12, m13, m31, m32, m33), - invDet * det3x3(m00, m02, m03, m10, m12, m13, m30, m32, m33), + -invDet * det3x3(m00, m02, m03, m10, m12, m13, m30, m32, m33), invDet * det3x3(m00, m01, m03, m10, m11, m13, m30, m31, m33), - invDet * det3x3(m00, m01, m02, m10, m11, m12, m30, m31, m32), + -invDet * det3x3(m00, m01, m02, m10, m11, m12, m30, m31, m32), // Fourth column (m3r): - invDet * det3x3(m01, m02, m03, m11, m12, m13, m21, m22, m23), + -invDet * det3x3(m01, m02, m03, m11, m12, m13, m21, m22, m23), invDet * det3x3(m00, m02, m03, m10, m12, m13, m20, m22, m23), - invDet * det3x3(m00, m01, m03, m10, m11, m13, m20, m21, m23), + -invDet * det3x3(m00, m01, m03, m10, m11, m13, m20, m21, m23), invDet * det3x3(m00, m01, m02, m10, m11, m12, m20, m21, m22), ]; diff --git a/testing/web-platform/tests/resources/chromium/webxr-test.js b/testing/web-platform/tests/resources/chromium/webxr-test.js index a9dd9b1d7c7c..4401972c8b38 100644 --- a/testing/web-platform/tests/resources/chromium/webxr-test.js +++ b/testing/web-platform/tests/resources/chromium/webxr-test.js @@ -3,7 +3,7 @@ // This polyfill library implements the WebXR Test API as specified here: // https://github.com/immersive-web/webxr-test-api - +// The standingTransform is floor_from_mojo and represented as such here. const default_standing = new gfx.mojom.Transform(); default_standing.matrix = [1, 0, 0, 0, 0, 1, 0, 0, @@ -409,8 +409,11 @@ class MockRuntime { } this.stageParameters_.standingTransform = new gfx.mojom.Transform(); + + // floorOrigin is passed in as mojoFromFloor; however, standingTransform is + // floorFromMojo so we need to invert the result of |getMatrixFromTransform| this.stageParameters_.standingTransform.matrix = - getMatrixFromTransform(floorOrigin); + XRMathHelper.inverse(getMatrixFromTransform(floorOrigin)); this.onStageParametersUpdated(); } diff --git a/testing/web-platform/tests/webxr/hit-test/ar_hittest_subscription_refSpaces.https.html b/testing/web-platform/tests/webxr/hit-test/ar_hittest_subscription_refSpaces.https.html index ecdfab479c7b..f1c223ae7495 100644 --- a/testing/web-platform/tests/webxr/hit-test/ar_hittest_subscription_refSpaces.https.html +++ b/testing/web-platform/tests/webxr/hit-test/ar_hittest_subscription_refSpaces.https.html @@ -17,14 +17,14 @@ const VIEWER_ORIGIN_TRANSFORM = { // 0.25m above world origin. const FLOOR_ORIGIN_TRANSFORM = { - position: [0, -0.25, 0], + position: [0, 0.25, 0], orientation: [0, 0, 0, 1], }; const fakeDeviceInitParams = { supportedModes: ["immersive-ar"], views: VALID_VIEWS, - floorOrigin: FLOOR_ORIGIN_TRANSFORM, // aka floor_from_mojo + floorOrigin: FLOOR_ORIGIN_TRANSFORM, // aka mojo_from_floor viewerOrigin: VIEWER_ORIGIN_TRANSFORM, // aka mojo_from_viewer supportedFeatures: ALL_FEATURES, world: createFakeWorld(5.0, 2.0, 5.0), // webxr_test_constants_fake_world.js has detailed description of the fake world diff --git a/testing/web-platform/tests/webxr/resources/webxr_test_constants.js b/testing/web-platform/tests/webxr/resources/webxr_test_constants.js index 959859cba213..19ddbc24200d 100644 --- a/testing/web-platform/tests/webxr/resources/webxr_test_constants.js +++ b/testing/web-platform/tests/webxr/resources/webxr_test_constants.js @@ -71,7 +71,7 @@ const VALID_FLOOR_ORIGIN_MATRIX = [1, 0, 0, 0, 1, 1.65, -1, 1]; const VALID_FLOOR_ORIGIN = { - position: [1.0, 1.65, -1.0], + position: [-1.0, -1.65, 1.0], orientation: [0, 0, 0, 1] }; diff --git a/testing/web-platform/tests/webxr/xrReferenceSpace_originOffsetBounded.https.html b/testing/web-platform/tests/webxr/xrReferenceSpace_originOffsetBounded.https.html index 7ef880c32c09..561c34ae9427 100644 --- a/testing/web-platform/tests/webxr/xrReferenceSpace_originOffsetBounded.https.html +++ b/testing/web-platform/tests/webxr/xrReferenceSpace_originOffsetBounded.https.html @@ -28,7 +28,7 @@ const VIEWS_WITH_OFFSET = [{ }]; const FLOOR_TRANSFORM = { - position: [0.1, 0.2, 0.3], + position: [-0.1, -0.2, -0.3], orientation: [0, 0, 0, 1] }; diff --git a/testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html b/testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html new file mode 100644 index 000000000000..f97ca6639f7c --- /dev/null +++ b/testing/web-platform/tests/webxr/xrReferenceSpace_relationships.https.html @@ -0,0 +1,59 @@ + + + + + + + + +