Bug 1626555 - Add dom/vr to the list of non-unified-build-compatible directories. r=sg

Depends on D96573

Differential Revision: https://phabricator.services.mozilla.com/D96586
This commit is contained in:
Andi-Bogdan Postelnicu 2020-11-10 16:08:48 +00:00
parent 1c0f5446e2
commit 265193a613
21 changed files with 53 additions and 24 deletions

View file

@ -61,3 +61,4 @@ dom/system/
dom/tests/
dom/u2f/
dom/url/
dom/vr/

View file

@ -6,6 +6,9 @@
#include "mozilla/dom/VRServiceTest.h"
#include "mozilla/dom/VRServiceTestBinding.h"
#include "mozilla/dom/GamepadPoseState.h"
#include "mozilla/dom/Promise.h"
#include "VRManagerChild.h"
#include "VRPuppetCommandBuffer.h"
#include <type_traits>

View file

@ -7,6 +7,7 @@
#include "mozilla/dom/XRBoundedReferenceSpace.h"
#include "mozilla/dom/XRRigidTransform.h"
#include "mozilla/dom/DOMPoint.h"
#include "VRDisplayClient.h"
namespace mozilla {
namespace dom {

View file

@ -6,8 +6,11 @@
#include "mozilla/dom/XRFrame.h"
#include "mozilla/dom/XRRenderState.h"
#include "mozilla/dom/XRRigidTransform.h"
#include "mozilla/dom/XRViewerPose.h"
#include "mozilla/dom/XRView.h"
#include "mozilla/dom/XRReferenceSpace.h"
#include "VRDisplayClient.h"
namespace mozilla {
namespace dom {
@ -62,7 +65,7 @@ already_AddRefed<XRViewerPose> XRFrame::GetViewerPose(
gfx::VRDisplayClient* display = mSession->GetDisplayClient();
if (display) {
// Have a VRDisplayClient
const VRDisplayInfo& displayInfo =
const gfx::VRDisplayInfo& displayInfo =
mSession->GetDisplayClient()->GetDisplayInfo();
const gfx::VRHMDSensorState& sensorState = display->GetSensorState();
@ -86,7 +89,7 @@ already_AddRefed<XRViewerPose> XRFrame::GetViewerPose(
viewerPose = mSession->PooledViewerPose(headTransform, emulatedPosition);
auto updateEye = [&](int32_t viewIndex, VRDisplayState::Eye eye) {
auto updateEye = [&](int32_t viewIndex, gfx::VRDisplayState::Eye eye) {
auto offset = displayInfo.GetEyeTranslation(eye);
auto eyeFromHead = gfx::Matrix4x4Double::Translation(
gfx::PointDouble3D(offset.x, offset.y, offset.z));
@ -97,7 +100,7 @@ already_AddRefed<XRViewerPose> XRFrame::GetViewerPose(
eyeTransform.Decompose(eyePosition, eyeRotation, eyeScale);
const gfx::VRFieldOfView fov = displayInfo.mDisplayState.eyeFOV[eye];
Matrix4x4 projection =
gfx::Matrix4x4 projection =
fov.ConstructProjectionMatrix(depthNear, depthFar, true);
viewerPose->GetEye(viewIndex)->Update(eyePosition, eyeRotation,
projection);
@ -114,7 +117,7 @@ already_AddRefed<XRViewerPose> XRFrame::GetViewerPose(
if (canvas) {
aspect = (float)canvas->Width() / (float)canvas->Height();
}
Matrix4x4 projection =
gfx::Matrix4x4 projection =
ConstructInlineProjection((float)fov, aspect, depthNear, depthFar);
viewerPose =
@ -180,7 +183,7 @@ void XRFrame::EndInputSourceEvent() { mActive = false; }
gfx::Matrix4x4 XRFrame::ConstructInlineProjection(float aFov, float aAspect,
float aNear, float aFar) {
Matrix4x4 m;
gfx::Matrix4x4 m;
const float depth = aFar - aNear;
const float invDepth = 1 / depth;
if (aFov == 0) {

View file

@ -9,6 +9,7 @@
#include "XRNativeOriginViewer.h"
#include "XRNativeOriginTracker.h"
#include "XRInputSpace.h"
#include "VRDisplayClient.h"
#include "mozilla/dom/Gamepad.h"
#include "mozilla/dom/GamepadManager.h"
@ -23,60 +24,60 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(XRInputSource, Release)
// Follow the controller profile ids from
// https://github.com/immersive-web/webxr-input-profiles.
nsTArray<nsString> GetInputSourceProfile(VRControllerType aType) {
nsTArray<nsString> GetInputSourceProfile(gfx::VRControllerType aType) {
nsTArray<nsString> profile;
nsString id;
switch (aType) {
case VRControllerType::HTCVive:
case gfx::VRControllerType::HTCVive:
id.AssignLiteral("htc-vive");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-squeeze-touchpad");
profile.AppendElement(id);
break;
case VRControllerType::HTCViveCosmos:
case gfx::VRControllerType::HTCViveCosmos:
id.AssignLiteral("htc-vive-cosmos");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-squeeze-thumbstick");
profile.AppendElement(id);
break;
case VRControllerType::HTCViveFocus:
case gfx::VRControllerType::HTCViveFocus:
id.AssignLiteral("htc-vive-focus");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-touchpad");
profile.AppendElement(id);
break;
case VRControllerType::HTCViveFocusPlus:
case gfx::VRControllerType::HTCViveFocusPlus:
id.AssignLiteral("htc-vive-focus-plus");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-squeeze-touchpad");
profile.AppendElement(id);
break;
case VRControllerType::MSMR:
case gfx::VRControllerType::MSMR:
id.AssignLiteral("microsoft-mixed-reality");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-squeeze-touchpad-thumbstick");
profile.AppendElement(id);
break;
case VRControllerType::ValveIndex:
case gfx::VRControllerType::ValveIndex:
id.AssignLiteral("valve-index");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-squeeze-touchpad-thumbstick");
profile.AppendElement(id);
break;
case VRControllerType::OculusGo:
case gfx::VRControllerType::OculusGo:
id.AssignLiteral("oculus-go");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-touchpad");
profile.AppendElement(id);
break;
case VRControllerType::OculusTouch:
case gfx::VRControllerType::OculusTouch:
id.AssignLiteral("oculus-touch");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-squeeze-thumbstick");
profile.AppendElement(id);
break;
case VRControllerType::OculusTouch2:
case gfx::VRControllerType::OculusTouch2:
id.AssignLiteral("oculus-touch-v2");
profile.AppendElement(id);
id.AssignLiteral("oculus-touch");
@ -84,19 +85,19 @@ nsTArray<nsString> GetInputSourceProfile(VRControllerType aType) {
id.AssignLiteral("generic-trigger-squeeze-thumbstick");
profile.AppendElement(id);
break;
case VRControllerType::PicoGaze:
case gfx::VRControllerType::PicoGaze:
id.AssignLiteral("pico-gaze");
profile.AppendElement(id);
id.AssignLiteral("generic-button");
profile.AppendElement(id);
break;
case VRControllerType::PicoG2:
case gfx::VRControllerType::PicoG2:
id.AssignLiteral("pico-g2");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-touchpad");
profile.AppendElement(id);
break;
case VRControllerType::PicoNeo2:
case gfx::VRControllerType::PicoNeo2:
id.AssignLiteral("pico-neo2");
profile.AppendElement(id);
id.AssignLiteral("generic-trigger-squeeze-thumbstick");
@ -197,7 +198,7 @@ void XRInputSource::Setup(XRSession* aSession, uint32_t aIndex) {
nativeOriginTargetRay, aIndex);
const uint32_t gamepadId =
displayInfo.mDisplayID * kVRControllerMaxCount + aIndex;
displayInfo.mDisplayID * gfx::kVRControllerMaxCount + aIndex;
const uint32_t hashKey = GamepadManager::GetGamepadIndexWithServiceType(
gamepadId, GamepadServiceType::VR);
mGamepad =

View file

@ -7,6 +7,7 @@
#include "mozilla/dom/XRInputSourceArray.h"
#include "mozilla/dom/XRSession.h"
#include "mozilla/dom/XRInputSourcesChangeEvent.h"
#include "VRDisplayClient.h"
namespace mozilla {
namespace dom {

View file

@ -5,6 +5,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "XRInputSpace.h"
#include "VRDisplayClient.h"
#include "mozilla/dom/GamepadPoseState.h"
namespace mozilla {
namespace dom {

View file

@ -8,6 +8,7 @@
#define mozilla_dom_XRInputSpace_h_
#include "XRInputSpace.h"
#include "mozilla/dom/XRSpace.h"
namespace mozilla {
namespace dom {

View file

@ -8,6 +8,7 @@
#define mozilla_dom_XRNativeOriginFixed_h_
#include "gfxVR.h"
#include "XRNativeOrigin.h"
namespace mozilla {
namespace dom {

View file

@ -5,11 +5,12 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "XRNativeOriginLocal.h"
#include "VRDisplayClient.h"
namespace mozilla {
namespace dom {
XRNativeOriginLocal::XRNativeOriginLocal(VRDisplayClient* aDisplay)
XRNativeOriginLocal::XRNativeOriginLocal(gfx::VRDisplayClient* aDisplay)
: mDisplay(aDisplay), mInitialPositionValid(false) {
MOZ_ASSERT(aDisplay);
}
@ -19,8 +20,9 @@ gfx::PointDouble3D XRNativeOriginLocal::GetPosition() {
if (!mInitialPositionValid) {
const gfx::VRHMDSensorState& sensorState = mDisplay->GetSensorState();
gfx::PointDouble3D origin;
if (sensorState.flags & VRDisplayCapabilityFlags::Cap_Position ||
sensorState.flags & VRDisplayCapabilityFlags::Cap_PositionEmulated) {
if (sensorState.flags & gfx::VRDisplayCapabilityFlags::Cap_Position ||
sensorState.flags &
gfx::VRDisplayCapabilityFlags::Cap_PositionEmulated) {
mInitialPosition.x = sensorState.pose.position[0];
mInitialPosition.y = sensorState.pose.position[1];
mInitialPosition.z = sensorState.pose.position[2];

View file

@ -8,6 +8,7 @@
#define mozilla_dom_XRNativeOriginLocal_h_
#include "gfxVR.h"
#include "XRNativeOrigin.h"
namespace mozilla {
namespace gfx {

View file

@ -5,11 +5,13 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "XRNativeOriginLocalFloor.h"
#include "VRDisplayClient.h"
namespace mozilla {
namespace dom {
XRNativeOriginLocalFloor::XRNativeOriginLocalFloor(VRDisplayClient* aDisplay)
XRNativeOriginLocalFloor::XRNativeOriginLocalFloor(
gfx::VRDisplayClient* aDisplay)
: mDisplay(aDisplay), mInitialPositionValid(false) {
MOZ_ASSERT(aDisplay);

View file

@ -8,6 +8,7 @@
#define mozilla_dom_XRNativeOriginLocalFloor_h_
#include "gfxVR.h"
#include "XRNativeOrigin.h"
namespace mozilla {
namespace gfx {

View file

@ -8,6 +8,7 @@
#define mozilla_dom_XRNativeOriginTracker_h_
#include "gfxVR.h"
#include "XRNativeOrigin.h"
namespace mozilla {
namespace dom {

View file

@ -5,11 +5,12 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "XRNativeOriginViewer.h"
#include "VRDisplayClient.h"
namespace mozilla {
namespace dom {
XRNativeOriginViewer::XRNativeOriginViewer(VRDisplayClient* aDisplay)
XRNativeOriginViewer::XRNativeOriginViewer(gfx::VRDisplayClient* aDisplay)
: mDisplay(aDisplay) {
MOZ_ASSERT(aDisplay);
}

View file

@ -8,6 +8,7 @@
#define mozilla_dom_XRNativeOriginViewer_h_
#include "gfxVR.h"
#include "XRNativeOrigin.h"
namespace mozilla {
namespace gfx {

View file

@ -5,6 +5,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/XRPose.h"
#include "mozilla/dom/XRRigidTransform.h"
namespace mozilla {
namespace dom {

View file

@ -9,6 +9,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/WebXRBinding.h"
#include "mozilla/dom/XRRigidTransform.h"
#include "gfxVR.h"

View file

@ -6,6 +6,7 @@
#include "mozilla/dom/XRSpace.h"
#include "mozilla/dom/XRRigidTransform.h"
#include "VRDisplayClient.h"
namespace mozilla {
namespace dom {

View file

@ -5,6 +5,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/XRView.h"
#include "mozilla/dom/XRRigidTransform.h"
#include "mozilla/dom/Pose.h"
namespace mozilla {
namespace dom {

View file

@ -5,6 +5,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/XRViewerPose.h"
#include "mozilla/dom/XRView.h"
namespace mozilla {
namespace dom {