From 8d3a2c11e585449abcb7953f46c180b3dde1d3d9 Mon Sep 17 00:00:00 2001 From: Andi-Bogdan Postelnicu Date: Mon, 30 Oct 2017 10:43:14 +0200 Subject: [PATCH] Bug 1411630 - make mozilla::gfx::VRHMDSensorState to be trivial typed. r=kip MozReview-Commit-ID: 7BniyasLIQD --- dom/vr/VRServiceTest.cpp | 1 + gfx/vr/VRDisplayHost.cpp | 2 ++ gfx/vr/gfxVR.h | 4 ---- gfx/vr/gfxVROSVR.cpp | 2 +- gfx/vr/gfxVROculus.cpp | 8 ++++---- gfx/vr/gfxVROpenVR.cpp | 2 +- gfx/vr/gfxVRPuppet.cpp | 1 + 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dom/vr/VRServiceTest.cpp b/dom/vr/VRServiceTest.cpp index 8b123e56470bc..ef65447ada71b 100644 --- a/dom/vr/VRServiceTest.cpp +++ b/dom/vr/VRServiceTest.cpp @@ -30,6 +30,7 @@ VRMockDisplay::VRMockDisplay(const nsCString& aID, uint32_t aDeviceID) : mDeviceID(aDeviceID) , mTimestamp(TimeStamp::Now()) { + memset(&mDisplayInfo, 0, sizeof(mDisplayInfo)); mDisplayInfo.mDisplayName = aID; mDisplayInfo.mType = VRDeviceType::Puppet; mDisplayInfo.mIsConnected = true; diff --git a/gfx/vr/VRDisplayHost.cpp b/gfx/vr/VRDisplayHost.cpp index fb2123529b8d9..85ca42aa4a1b8 100644 --- a/gfx/vr/VRDisplayHost.cpp +++ b/gfx/vr/VRDisplayHost.cpp @@ -65,6 +65,8 @@ VRDisplayHost::VRDisplayHost(VRDeviceType aType) : mFrameStarted(false) { MOZ_COUNT_CTOR(VRDisplayHost); + memset(&mDisplayInfo, 0, sizeof(VRDisplayInfo)); + memset(&mLastUpdateDisplayInfo, 0, sizeof(VRDisplayInfo)); mDisplayInfo.mType = aType; mDisplayInfo.mDisplayID = VRSystemManager::AllocateDisplayID(); mDisplayInfo.mPresentingGroups = 0; diff --git a/gfx/vr/gfxVR.h b/gfx/vr/gfxVR.h index b3c967ee23665..261e61f04c65b 100644 --- a/gfx/vr/gfxVR.h +++ b/gfx/vr/gfxVR.h @@ -133,10 +133,6 @@ struct VRFieldOfView { }; struct VRHMDSensorState { - VRHMDSensorState() - { - Clear(); - } int64_t inputFrameID; double timestamp; VRDisplayCapabilityFlags flags; diff --git a/gfx/vr/gfxVROSVR.cpp b/gfx/vr/gfxVROSVR.cpp index 42741c50eddd5..76df13a63c9ee 100644 --- a/gfx/vr/gfxVROSVR.cpp +++ b/gfx/vr/gfxVROSVR.cpp @@ -287,7 +287,7 @@ VRDisplayOSVR::GetSensorState() //this usually goes into app's mainloop osvr_ClientUpdate(*m_ctx); - VRHMDSensorState result; + VRHMDSensorState result{}; OSVR_TimeValue timestamp; OSVR_OrientationState orientation; diff --git a/gfx/vr/gfxVROculus.cpp b/gfx/vr/gfxVROculus.cpp index a6e4224c78c09..e1bea91f05bea 100644 --- a/gfx/vr/gfxVROculus.cpp +++ b/gfx/vr/gfxVROculus.cpp @@ -863,7 +863,7 @@ VRDisplayOculus::ZeroSensor() VRHMDSensorState VRDisplayOculus::GetSensorState() { - VRHMDSensorState result; + VRHMDSensorState result{}; if (mSession->IsTrackingReady()) { double predictedFrameTime = 0.0f; if (gfxPrefs::VRPosePredictionEnabled()) { @@ -882,7 +882,7 @@ VRDisplayOculus::GetSensorState() VRHMDSensorState VRDisplayOculus::GetSensorState(double absTime) { - VRHMDSensorState result; + VRHMDSensorState result{}; ovrTrackingState state = ovr_GetTrackingState(mSession->Get(), absTime, true); ovrPoseStatef& pose(state.HeadPose); @@ -896,7 +896,7 @@ VRDisplayOculus::GetSensorState(double absTime) result.orientation[1] = pose.ThePose.Orientation.y; result.orientation[2] = pose.ThePose.Orientation.z; result.orientation[3] = pose.ThePose.Orientation.w; - + result.angularVelocity[0] = pose.AngularVelocity.x; result.angularVelocity[1] = pose.AngularVelocity.y; result.angularVelocity[2] = pose.AngularVelocity.z; @@ -914,7 +914,7 @@ VRDisplayOculus::GetSensorState(double absTime) result.position[0] = pose.ThePose.Position.x; result.position[1] = pose.ThePose.Position.y; result.position[2] = pose.ThePose.Position.z; - + result.linearVelocity[0] = pose.LinearVelocity.x; result.linearVelocity[1] = pose.LinearVelocity.y; result.linearVelocity[2] = pose.LinearVelocity.z; diff --git a/gfx/vr/gfxVROpenVR.cpp b/gfx/vr/gfxVROpenVR.cpp index 2f1dba6424919..0da628e0bcf98 100644 --- a/gfx/vr/gfxVROpenVR.cpp +++ b/gfx/vr/gfxVROpenVR.cpp @@ -231,7 +231,7 @@ VRDisplayOpenVR::GetSensorState() // Note: We *must* call WaitGetPoses in order for any rendering to happen at all. mVRCompositor->WaitGetPoses(nullptr, 0, poses, posesSize); - VRHMDSensorState result; + VRHMDSensorState result{}; ::vr::Compositor_FrameTiming timing; timing.m_nSize = sizeof(::vr::Compositor_FrameTiming); diff --git a/gfx/vr/gfxVRPuppet.cpp b/gfx/vr/gfxVRPuppet.cpp index 531795bc11bf5..cc6fa304b93cc 100644 --- a/gfx/vr/gfxVRPuppet.cpp +++ b/gfx/vr/gfxVRPuppet.cpp @@ -51,6 +51,7 @@ static const uint32_t kNumPuppetHaptcs = 1; VRDisplayPuppet::VRDisplayPuppet() : VRDisplayHost(VRDeviceType::Puppet) , mIsPresenting(false) + , mSensorState{} { MOZ_COUNT_CTOR_INHERITED(VRDisplayPuppet, VRDisplayHost);