зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1474034
- Use consistent prefixes for POD struct members in gfx/vr/external_api/moz_external_vr.h r=kip
This change updates the structs VRDisplayState, VRLayer_2D_Content, and VRLayer_Stereo_Immersive to not have 'm' prefix for its members. Differential Revision: https://phabricator.services.mozilla.com/D16000 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3df27b4278
Коммит
b16b2cbba6
|
@ -802,11 +802,11 @@ void VRFrameInfo::Update(const gfx::VRDisplayInfo& aInfo,
|
|||
}
|
||||
|
||||
const gfx::VRFieldOfView leftFOV =
|
||||
aInfo.mDisplayState.mEyeFOV[gfx::VRDisplayState::Eye_Left];
|
||||
aInfo.mDisplayState.eyeFOV[gfx::VRDisplayState::Eye_Left];
|
||||
mLeftProjection =
|
||||
leftFOV.ConstructProjectionMatrix(aDepthNear, aDepthFar, true);
|
||||
const gfx::VRFieldOfView rightFOV =
|
||||
aInfo.mDisplayState.mEyeFOV[gfx::VRDisplayState::Eye_Right];
|
||||
aInfo.mDisplayState.eyeFOV[gfx::VRDisplayState::Eye_Right];
|
||||
mRightProjection =
|
||||
rightFOV.ConstructProjectionMatrix(aDepthNear, aDepthFar, true);
|
||||
memcpy(mLeftView.components, aState.leftViewMatrix,
|
||||
|
|
|
@ -32,19 +32,19 @@ VRMockDisplay::VRMockDisplay(const nsCString& aID, uint32_t aDeviceID)
|
|||
mSensorState{},
|
||||
mTimestamp(TimeStamp::Now()) {
|
||||
VRDisplayState& state = mDisplayInfo.mDisplayState;
|
||||
strncpy(state.mDisplayName, aID.BeginReading(), kVRDisplayNameMaxLen);
|
||||
strncpy(state.displayName, aID.BeginReading(), kVRDisplayNameMaxLen);
|
||||
mDisplayInfo.mType = VRDeviceType::Puppet;
|
||||
state.mIsConnected = true;
|
||||
state.mIsMounted = false;
|
||||
state.mCapabilityFlags = VRDisplayCapabilityFlags::Cap_None |
|
||||
VRDisplayCapabilityFlags::Cap_Orientation |
|
||||
VRDisplayCapabilityFlags::Cap_AngularAcceleration |
|
||||
VRDisplayCapabilityFlags::Cap_Position |
|
||||
VRDisplayCapabilityFlags::Cap_LinearAcceleration |
|
||||
VRDisplayCapabilityFlags::Cap_External |
|
||||
VRDisplayCapabilityFlags::Cap_Present |
|
||||
VRDisplayCapabilityFlags::Cap_StageParameters |
|
||||
VRDisplayCapabilityFlags::Cap_MountDetection;
|
||||
state.isConnected = true;
|
||||
state.isMounted = false;
|
||||
state.capabilityFlags = VRDisplayCapabilityFlags::Cap_None |
|
||||
VRDisplayCapabilityFlags::Cap_Orientation |
|
||||
VRDisplayCapabilityFlags::Cap_AngularAcceleration |
|
||||
VRDisplayCapabilityFlags::Cap_Position |
|
||||
VRDisplayCapabilityFlags::Cap_LinearAcceleration |
|
||||
VRDisplayCapabilityFlags::Cap_External |
|
||||
VRDisplayCapabilityFlags::Cap_Present |
|
||||
VRDisplayCapabilityFlags::Cap_StageParameters |
|
||||
VRDisplayCapabilityFlags::Cap_MountDetection;
|
||||
}
|
||||
|
||||
JSObject* VRMockDisplay::WrapObject(JSContext* aCx,
|
||||
|
@ -54,8 +54,8 @@ JSObject* VRMockDisplay::WrapObject(JSContext* aCx,
|
|||
|
||||
void VRMockDisplay::SetEyeResolution(unsigned long aRenderWidth,
|
||||
unsigned long aRenderHeight) {
|
||||
mDisplayInfo.mDisplayState.mEyeResolution.width = aRenderWidth;
|
||||
mDisplayInfo.mDisplayState.mEyeResolution.height = aRenderHeight;
|
||||
mDisplayInfo.mDisplayState.eyeResolution.width = aRenderWidth;
|
||||
mDisplayInfo.mDisplayState.eyeResolution.height = aRenderHeight;
|
||||
}
|
||||
|
||||
void VRMockDisplay::SetEyeParameter(VREye aEye, double aOffsetX,
|
||||
|
@ -63,11 +63,11 @@ void VRMockDisplay::SetEyeParameter(VREye aEye, double aOffsetX,
|
|||
double aUpDegree, double aRightDegree,
|
||||
double aDownDegree, double aLeftDegree) {
|
||||
uint32_t eye = static_cast<uint32_t>(aEye);
|
||||
mDisplayInfo.mDisplayState.mEyeFOV[eye] =
|
||||
mDisplayInfo.mDisplayState.eyeFOV[eye] =
|
||||
gfx ::VRFieldOfView(aUpDegree, aRightDegree, aRightDegree, aLeftDegree);
|
||||
mDisplayInfo.mDisplayState.mEyeTranslation[eye].x = aOffsetX;
|
||||
mDisplayInfo.mDisplayState.mEyeTranslation[eye].y = aOffsetY;
|
||||
mDisplayInfo.mDisplayState.mEyeTranslation[eye].z = aOffsetZ;
|
||||
mDisplayInfo.mDisplayState.eyeTranslation[eye].x = aOffsetX;
|
||||
mDisplayInfo.mDisplayState.eyeTranslation[eye].y = aOffsetY;
|
||||
mDisplayInfo.mDisplayState.eyeTranslation[eye].z = aOffsetZ;
|
||||
}
|
||||
|
||||
void VRMockDisplay::SetPose(
|
||||
|
|
|
@ -33,7 +33,7 @@ class VRMockDisplay final : public DOMEventTargetHelper {
|
|||
const Nullable<Float32Array>& aAngularVelocity,
|
||||
const Nullable<Float32Array>& aAngularAcceleration);
|
||||
void SetMountState(bool aIsMounted) {
|
||||
mDisplayInfo.mDisplayState.mIsMounted = aIsMounted;
|
||||
mDisplayInfo.mDisplayState.isMounted = aIsMounted;
|
||||
}
|
||||
void Update();
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
|
|
|
@ -71,7 +71,7 @@ void VRDisplayClient::SetGroupMask(uint32_t aGroupMask) {
|
|||
|
||||
bool VRDisplayClient::IsPresentationGenerationCurrent() const {
|
||||
if (mLastPresentingGeneration !=
|
||||
mDisplayInfo.mDisplayState.mPresentingGeneration) {
|
||||
mDisplayInfo.mDisplayState.presentingGeneration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ bool VRDisplayClient::IsPresentationGenerationCurrent() const {
|
|||
}
|
||||
|
||||
void VRDisplayClient::MakePresentationGenerationCurrent() {
|
||||
mLastPresentingGeneration = mDisplayInfo.mDisplayState.mPresentingGeneration;
|
||||
mLastPresentingGeneration = mDisplayInfo.mDisplayState.presentingGeneration;
|
||||
}
|
||||
|
||||
void VRDisplayClient::FireEvents() {
|
||||
|
@ -94,7 +94,7 @@ void VRDisplayClient::FireEvents() {
|
|||
}
|
||||
|
||||
// Check if we need to trigger onvrdisplayactivate event
|
||||
if (!bLastEventWasMounted && mDisplayInfo.mDisplayState.mIsMounted) {
|
||||
if (!bLastEventWasMounted && mDisplayInfo.mDisplayState.isMounted) {
|
||||
bLastEventWasMounted = true;
|
||||
if (gfxPrefs::VRAutoActivateEnabled()) {
|
||||
vm->FireDOMVRDisplayMountedEvent(mDisplayInfo.mDisplayID);
|
||||
|
@ -102,7 +102,7 @@ void VRDisplayClient::FireEvents() {
|
|||
}
|
||||
|
||||
// Check if we need to trigger onvrdisplaydeactivate event
|
||||
if (bLastEventWasMounted && !mDisplayInfo.mDisplayState.mIsMounted) {
|
||||
if (bLastEventWasMounted && !mDisplayInfo.mDisplayState.isMounted) {
|
||||
bLastEventWasMounted = false;
|
||||
if (gfxPrefs::VRAutoActivateEnabled()) {
|
||||
vm->FireDOMVRDisplayUnmountedEvent(mDisplayInfo.mDisplayID);
|
||||
|
@ -110,9 +110,8 @@ void VRDisplayClient::FireEvents() {
|
|||
}
|
||||
|
||||
if (mLastPresentingGeneration !=
|
||||
mDisplayInfo.mDisplayState.mPresentingGeneration) {
|
||||
mLastPresentingGeneration =
|
||||
mDisplayInfo.mDisplayState.mPresentingGeneration;
|
||||
mDisplayInfo.mDisplayState.presentingGeneration) {
|
||||
mLastPresentingGeneration = mDisplayInfo.mDisplayState.presentingGeneration;
|
||||
vm->NotifyPresentationGenerationChanged(mDisplayInfo.mDisplayID);
|
||||
}
|
||||
|
||||
|
@ -276,7 +275,7 @@ bool VRDisplayClient::GetIsConnected() const {
|
|||
}
|
||||
|
||||
void VRDisplayClient::NotifyDisconnected() {
|
||||
mDisplayInfo.mDisplayState.mIsConnected = false;
|
||||
mDisplayInfo.mDisplayState.isConnected = false;
|
||||
}
|
||||
|
||||
void VRDisplayClient::UpdateSubmitFrameResult(
|
||||
|
|
|
@ -73,8 +73,8 @@ VRDisplayHost::VRDisplayHost(VRDeviceType aType)
|
|||
mDisplayInfo.mPresentingGroups = 0;
|
||||
mDisplayInfo.mGroupMask = kVRGroupContent;
|
||||
mDisplayInfo.mFrameId = 0;
|
||||
mDisplayInfo.mDisplayState.mPresentingGeneration = 0;
|
||||
mDisplayInfo.mDisplayState.mDisplayName[0] = '\0';
|
||||
mDisplayInfo.mDisplayState.presentingGeneration = 0;
|
||||
mDisplayInfo.mDisplayState.displayName[0] = '\0';
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
mLastSubmittedFrameId = 0;
|
||||
|
@ -144,7 +144,7 @@ void VRDisplayHost::SetGroupMask(uint32_t aGroupMask) {
|
|||
}
|
||||
|
||||
bool VRDisplayHost::GetIsConnected() {
|
||||
return mDisplayInfo.mDisplayState.mIsConnected;
|
||||
return mDisplayInfo.mDisplayState.isConnected;
|
||||
}
|
||||
|
||||
void VRDisplayHost::AddLayer(VRLayerParent* aLayer) {
|
||||
|
@ -189,7 +189,7 @@ void VRDisplayHost::StartFrame() {
|
|||
* processed.
|
||||
*/
|
||||
if (isPresenting && mLastStartedFrame > 0 &&
|
||||
mDisplayInfo.mDisplayState.mLastSubmittedFrameId < mLastStartedFrame &&
|
||||
mDisplayInfo.mDisplayState.lastSubmittedFrameId < mLastStartedFrame &&
|
||||
duration < (double)ANDROID_MAX_FRAME_DURATION) {
|
||||
return;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ void VRDisplayHost::SubmitFrame(VRLayerParent* aLayer,
|
|||
*/
|
||||
if (mLastSubmittedFrameId > 0 &&
|
||||
mLastSubmittedFrameId !=
|
||||
mDisplayInfo.mDisplayState.mLastSubmittedFrameId) {
|
||||
mDisplayInfo.mDisplayState.lastSubmittedFrameId) {
|
||||
mLastStartedFrame = 0;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -255,29 +255,29 @@ struct VRDisplayState {
|
|||
bool shutdown;
|
||||
// Minimum number of milliseconds to wait before attempting
|
||||
// to start the VR service again
|
||||
uint32_t mMinRestartInterval;
|
||||
char mDisplayName[kVRDisplayNameMaxLen];
|
||||
uint32_t minRestartInterval;
|
||||
char displayName[kVRDisplayNameMaxLen];
|
||||
// eight byte character code identifier
|
||||
// LSB first, so "ABCDEFGH" -> ('H'<<56) + ('G'<<48) + ('F'<<40) +
|
||||
// ('E'<<32) + ('D'<<24) + ('C'<<16) +
|
||||
// ('B'<<8) + 'A').
|
||||
uint64_t mEightCC;
|
||||
VRDisplayCapabilityFlags mCapabilityFlags;
|
||||
VRFieldOfView mEyeFOV[VRDisplayState::NumEyes];
|
||||
Point3D_POD mEyeTranslation[VRDisplayState::NumEyes];
|
||||
IntSize_POD mEyeResolution;
|
||||
bool mSuppressFrames;
|
||||
bool mIsConnected;
|
||||
bool mIsMounted;
|
||||
FloatSize_POD mStageSize;
|
||||
uint64_t eightCC;
|
||||
VRDisplayCapabilityFlags capabilityFlags;
|
||||
VRFieldOfView eyeFOV[VRDisplayState::NumEyes];
|
||||
Point3D_POD eyeTranslation[VRDisplayState::NumEyes];
|
||||
IntSize_POD eyeResolution;
|
||||
bool suppressFrames;
|
||||
bool isConnected;
|
||||
bool isMounted;
|
||||
FloatSize_POD stageSize;
|
||||
// We can't use a Matrix4x4 here unless we ensure it's a POD type
|
||||
float mSittingToStandingTransform[16];
|
||||
uint64_t mLastSubmittedFrameId;
|
||||
bool mLastSubmittedFrameSuccessful;
|
||||
uint32_t mPresentingGeneration;
|
||||
float sittingToStandingTransform[16];
|
||||
uint64_t lastSubmittedFrameId;
|
||||
bool lastSubmittedFrameSuccessful;
|
||||
uint32_t presentingGeneration;
|
||||
// Telemetry
|
||||
bool mReportsDroppedFrames;
|
||||
uint64_t mDroppedFrameCount;
|
||||
bool reportsDroppedFrames;
|
||||
uint64_t droppedFrameCount;
|
||||
};
|
||||
|
||||
struct VRControllerState {
|
||||
|
@ -328,18 +328,18 @@ enum class VRLayerTextureType : uint16_t {
|
|||
};
|
||||
|
||||
struct VRLayer_2D_Content {
|
||||
VRLayerTextureHandle mTextureHandle;
|
||||
VRLayerTextureType mTextureType;
|
||||
uint64_t mFrameId;
|
||||
VRLayerTextureHandle textureHandle;
|
||||
VRLayerTextureType textureType;
|
||||
uint64_t frameId;
|
||||
};
|
||||
|
||||
struct VRLayer_Stereo_Immersive {
|
||||
VRLayerTextureHandle mTextureHandle;
|
||||
VRLayerTextureType mTextureType;
|
||||
uint64_t mFrameId;
|
||||
uint64_t mInputFrameId;
|
||||
VRLayerEyeRect mLeftEyeRect;
|
||||
VRLayerEyeRect mRightEyeRect;
|
||||
VRLayerTextureHandle textureHandle;
|
||||
VRLayerTextureType textureType;
|
||||
uint64_t frameId;
|
||||
uint64_t inputFrameId;
|
||||
VRLayerEyeRect leftEyeRect;
|
||||
VRLayerEyeRect rightEyeRect;
|
||||
};
|
||||
|
||||
struct VRLayerState {
|
||||
|
|
|
@ -190,25 +190,25 @@ void VRHMDSensorState::CalcViewMatrices(
|
|||
}
|
||||
|
||||
const IntSize VRDisplayInfo::SuggestedEyeResolution() const {
|
||||
return IntSize(mDisplayState.mEyeResolution.width,
|
||||
mDisplayState.mEyeResolution.height);
|
||||
return IntSize(mDisplayState.eyeResolution.width,
|
||||
mDisplayState.eyeResolution.height);
|
||||
}
|
||||
|
||||
const Point3D VRDisplayInfo::GetEyeTranslation(uint32_t whichEye) const {
|
||||
return Point3D(mDisplayState.mEyeTranslation[whichEye].x,
|
||||
mDisplayState.mEyeTranslation[whichEye].y,
|
||||
mDisplayState.mEyeTranslation[whichEye].z);
|
||||
return Point3D(mDisplayState.eyeTranslation[whichEye].x,
|
||||
mDisplayState.eyeTranslation[whichEye].y,
|
||||
mDisplayState.eyeTranslation[whichEye].z);
|
||||
}
|
||||
|
||||
const Size VRDisplayInfo::GetStageSize() const {
|
||||
return Size(mDisplayState.mStageSize.width, mDisplayState.mStageSize.height);
|
||||
return Size(mDisplayState.stageSize.width, mDisplayState.stageSize.height);
|
||||
}
|
||||
|
||||
const Matrix4x4 VRDisplayInfo::GetSittingToStandingTransform() const {
|
||||
Matrix4x4 m;
|
||||
// If we could replace Matrix4x4 with a pod type, we could
|
||||
// use it directly from the VRDisplayInfo struct.
|
||||
memcpy(m.components, mDisplayState.mSittingToStandingTransform,
|
||||
memcpy(m.components, mDisplayState.sittingToStandingTransform,
|
||||
sizeof(float) * 16);
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -76,18 +76,18 @@ struct VRDisplayInfo {
|
|||
|
||||
VRDeviceType GetType() const { return mType; }
|
||||
uint32_t GetDisplayID() const { return mDisplayID; }
|
||||
const char* GetDisplayName() const { return mDisplayState.mDisplayName; }
|
||||
const char* GetDisplayName() const { return mDisplayState.displayName; }
|
||||
VRDisplayCapabilityFlags GetCapabilities() const {
|
||||
return mDisplayState.mCapabilityFlags;
|
||||
return mDisplayState.capabilityFlags;
|
||||
}
|
||||
|
||||
const IntSize SuggestedEyeResolution() const;
|
||||
const Point3D GetEyeTranslation(uint32_t whichEye) const;
|
||||
const VRFieldOfView& GetEyeFOV(uint32_t whichEye) const {
|
||||
return mDisplayState.mEyeFOV[whichEye];
|
||||
return mDisplayState.eyeFOV[whichEye];
|
||||
}
|
||||
bool GetIsConnected() const { return mDisplayState.mIsConnected; }
|
||||
bool GetIsMounted() const { return mDisplayState.mIsMounted; }
|
||||
bool GetIsConnected() const { return mDisplayState.isConnected; }
|
||||
bool GetIsMounted() const { return mDisplayState.isMounted; }
|
||||
uint32_t GetPresentingGroups() const { return mPresentingGroups; }
|
||||
uint32_t GetGroupMask() const { return mGroupMask; }
|
||||
const Size GetStageSize() const;
|
||||
|
|
|
@ -115,10 +115,10 @@ void VRDisplayExternal::StartPresentation() {
|
|||
mBrowserState.layerState[0].type = VRLayerType::LayerType_Stereo_Immersive;
|
||||
PushState();
|
||||
|
||||
mDisplayInfo.mDisplayState.mLastSubmittedFrameId = 0;
|
||||
if (mDisplayInfo.mDisplayState.mReportsDroppedFrames) {
|
||||
mDisplayInfo.mDisplayState.lastSubmittedFrameId = 0;
|
||||
if (mDisplayInfo.mDisplayState.reportsDroppedFrames) {
|
||||
mTelemetry.mLastDroppedFrameCount =
|
||||
mDisplayInfo.mDisplayState.mDroppedFrameCount;
|
||||
mDisplayInfo.mDisplayState.droppedFrameCount;
|
||||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
|
@ -143,13 +143,13 @@ void VRDisplayExternal::StopPresentation() {
|
|||
Telemetry::HistogramID droppedFramesID = Telemetry::HistogramCount;
|
||||
int viewIn = 0;
|
||||
|
||||
if (mDisplayInfo.mDisplayState.mEightCC ==
|
||||
if (mDisplayInfo.mDisplayState.eightCC ==
|
||||
GFX_VR_EIGHTCC('O', 'c', 'u', 'l', 'u', 's', ' ', 'D')) {
|
||||
// Oculus Desktop API
|
||||
timeSpentID = Telemetry::WEBVR_TIME_SPENT_VIEWING_IN_OCULUS;
|
||||
droppedFramesID = Telemetry::WEBVR_DROPPED_FRAMES_IN_OCULUS;
|
||||
viewIn = 1;
|
||||
} else if (mDisplayInfo.mDisplayState.mEightCC ==
|
||||
} else if (mDisplayInfo.mDisplayState.eightCC ==
|
||||
GFX_VR_EIGHTCC('O', 'p', 'e', 'n', 'V', 'R', ' ', ' ')) {
|
||||
// OpenVR API
|
||||
timeSpentID = Telemetry::WEBVR_TIME_SPENT_VIEWING_IN_OPENVR;
|
||||
|
@ -163,7 +163,7 @@ void VRDisplayExternal::StopPresentation() {
|
|||
Telemetry::Accumulate(Telemetry::WEBVR_USERS_VIEW_IN, viewIn);
|
||||
Telemetry::Accumulate(timeSpentID, duration.ToMilliseconds());
|
||||
const uint32_t droppedFramesPerSec =
|
||||
(mDisplayInfo.mDisplayState.mDroppedFrameCount -
|
||||
(mDisplayInfo.mDisplayState.droppedFrameCount -
|
||||
mTelemetry.mLastDroppedFrameCount) /
|
||||
duration.ToSeconds();
|
||||
Telemetry::Accumulate(droppedFramesID, droppedFramesPerSec);
|
||||
|
@ -238,44 +238,44 @@ bool VRDisplayExternal::SubmitFrame(const layers::SurfaceDescriptor& aTexture,
|
|||
VRLayerType::LayerType_Stereo_Immersive);
|
||||
VRLayer_Stereo_Immersive& layer =
|
||||
mBrowserState.layerState[0].layer_stereo_immersive;
|
||||
if (!PopulateLayerTexture(aTexture, &layer.mTextureType,
|
||||
&layer.mTextureHandle)) {
|
||||
if (!PopulateLayerTexture(aTexture, &layer.textureType,
|
||||
&layer.textureHandle)) {
|
||||
return false;
|
||||
}
|
||||
layer.mFrameId = aFrameId;
|
||||
layer.mInputFrameId =
|
||||
layer.frameId = aFrameId;
|
||||
layer.inputFrameId =
|
||||
mDisplayInfo.mLastSensorState[mDisplayInfo.mFrameId % kVRMaxLatencyFrames]
|
||||
.inputFrameID;
|
||||
|
||||
layer.mLeftEyeRect.x = aLeftEyeRect.x;
|
||||
layer.mLeftEyeRect.y = aLeftEyeRect.y;
|
||||
layer.mLeftEyeRect.width = aLeftEyeRect.width;
|
||||
layer.mLeftEyeRect.height = aLeftEyeRect.height;
|
||||
layer.mRightEyeRect.x = aRightEyeRect.x;
|
||||
layer.mRightEyeRect.y = aRightEyeRect.y;
|
||||
layer.mRightEyeRect.width = aRightEyeRect.width;
|
||||
layer.mRightEyeRect.height = aRightEyeRect.height;
|
||||
layer.leftEyeRect.x = aLeftEyeRect.x;
|
||||
layer.leftEyeRect.y = aLeftEyeRect.y;
|
||||
layer.leftEyeRect.width = aLeftEyeRect.width;
|
||||
layer.leftEyeRect.height = aLeftEyeRect.height;
|
||||
layer.rightEyeRect.x = aRightEyeRect.x;
|
||||
layer.rightEyeRect.y = aRightEyeRect.y;
|
||||
layer.rightEyeRect.width = aRightEyeRect.width;
|
||||
layer.rightEyeRect.height = aRightEyeRect.height;
|
||||
|
||||
PushState(true);
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
PullState([&]() {
|
||||
return (mDisplayInfo.mDisplayState.mLastSubmittedFrameId >= aFrameId) ||
|
||||
mDisplayInfo.mDisplayState.mSuppressFrames ||
|
||||
!mDisplayInfo.mDisplayState.mIsConnected;
|
||||
return (mDisplayInfo.mDisplayState.lastSubmittedFrameId >= aFrameId) ||
|
||||
mDisplayInfo.mDisplayState.suppressFrames ||
|
||||
!mDisplayInfo.mDisplayState.isConnected;
|
||||
});
|
||||
|
||||
if (mDisplayInfo.mDisplayState.mSuppressFrames ||
|
||||
!mDisplayInfo.mDisplayState.mIsConnected) {
|
||||
if (mDisplayInfo.mDisplayState.suppressFrames ||
|
||||
!mDisplayInfo.mDisplayState.isConnected) {
|
||||
// External implementation wants to supress frames, service has shut down or
|
||||
// hardware has been disconnected.
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
while (mDisplayInfo.mDisplayState.mLastSubmittedFrameId < aFrameId) {
|
||||
while (mDisplayInfo.mDisplayState.lastSubmittedFrameId < aFrameId) {
|
||||
if (PullState()) {
|
||||
if (mDisplayInfo.mDisplayState.mSuppressFrames ||
|
||||
!mDisplayInfo.mDisplayState.mIsConnected) {
|
||||
if (mDisplayInfo.mDisplayState.suppressFrames ||
|
||||
!mDisplayInfo.mDisplayState.isConnected) {
|
||||
// External implementation wants to supress frames, service has shut
|
||||
// down or hardware has been disconnected.
|
||||
return false;
|
||||
|
@ -289,7 +289,7 @@ bool VRDisplayExternal::SubmitFrame(const layers::SurfaceDescriptor& aTexture,
|
|||
}
|
||||
#endif // defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
return mDisplayInfo.mDisplayState.mLastSubmittedFrameSuccessful;
|
||||
return mDisplayInfo.mDisplayState.lastSubmittedFrameSuccessful;
|
||||
}
|
||||
|
||||
void VRDisplayExternal::VibrateHaptic(uint32_t aControllerIdx,
|
||||
|
@ -636,7 +636,7 @@ void VRSystemManagerExternal::Enumerate() {
|
|||
}
|
||||
#endif // defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
if (displayState.mIsConnected) {
|
||||
if (displayState.isConnected) {
|
||||
mDisplay = new VRDisplayExternal(displayState);
|
||||
}
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ bool VRSystemManagerExternal::PullState(
|
|||
if (!mEarliestRestartTime.IsNull() && mEarliestRestartTime < now) {
|
||||
mEarliestRestartTime =
|
||||
now + TimeDuration::FromMilliseconds(
|
||||
(double)aDisplayState->mMinRestartInterval);
|
||||
(double)aDisplayState->minRestartInterval);
|
||||
}
|
||||
}
|
||||
if (!aWaitCondition || aWaitCondition()) {
|
||||
|
@ -816,7 +816,7 @@ bool VRSystemManagerExternal::PullState(
|
|||
if (!mEarliestRestartTime.IsNull() && mEarliestRestartTime < now) {
|
||||
mEarliestRestartTime =
|
||||
now + TimeDuration::FromMilliseconds(
|
||||
(double)aDisplayState->mMinRestartInterval);
|
||||
(double)aDisplayState->minRestartInterval);
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
|
|
|
@ -55,50 +55,50 @@ VRDisplayPuppet::VRDisplayPuppet()
|
|||
MOZ_COUNT_CTOR_INHERITED(VRDisplayPuppet, VRDisplayLocal);
|
||||
|
||||
VRDisplayState& state = mDisplayInfo.mDisplayState;
|
||||
strncpy(state.mDisplayName, "Puppet HMD", kVRDisplayNameMaxLen);
|
||||
state.mIsConnected = true;
|
||||
state.mIsMounted = false;
|
||||
state.mCapabilityFlags = VRDisplayCapabilityFlags::Cap_None |
|
||||
VRDisplayCapabilityFlags::Cap_Orientation |
|
||||
VRDisplayCapabilityFlags::Cap_Position |
|
||||
VRDisplayCapabilityFlags::Cap_External |
|
||||
VRDisplayCapabilityFlags::Cap_Present |
|
||||
VRDisplayCapabilityFlags::Cap_StageParameters;
|
||||
state.mEyeResolution.width = 1836; // 1080 * 1.7
|
||||
state.mEyeResolution.height = 2040; // 1200 * 1.7
|
||||
strncpy(state.displayName, "Puppet HMD", kVRDisplayNameMaxLen);
|
||||
state.isConnected = true;
|
||||
state.isMounted = false;
|
||||
state.capabilityFlags = VRDisplayCapabilityFlags::Cap_None |
|
||||
VRDisplayCapabilityFlags::Cap_Orientation |
|
||||
VRDisplayCapabilityFlags::Cap_Position |
|
||||
VRDisplayCapabilityFlags::Cap_External |
|
||||
VRDisplayCapabilityFlags::Cap_Present |
|
||||
VRDisplayCapabilityFlags::Cap_StageParameters;
|
||||
state.eyeResolution.width = 1836; // 1080 * 1.7
|
||||
state.eyeResolution.height = 2040; // 1200 * 1.7
|
||||
|
||||
// SteamVR gives the application a single FOV to use; it's not configurable as
|
||||
// with Oculus
|
||||
for (uint32_t eye = 0; eye < 2; ++eye) {
|
||||
state.mEyeTranslation[eye].x = 0.0f;
|
||||
state.mEyeTranslation[eye].y = 0.0f;
|
||||
state.mEyeTranslation[eye].z = 0.0f;
|
||||
state.mEyeFOV[eye] = VRFieldOfView(45.0, 45.0, 45.0, 45.0);
|
||||
state.eyeTranslation[eye].x = 0.0f;
|
||||
state.eyeTranslation[eye].y = 0.0f;
|
||||
state.eyeTranslation[eye].z = 0.0f;
|
||||
state.eyeFOV[eye] = VRFieldOfView(45.0, 45.0, 45.0, 45.0);
|
||||
}
|
||||
|
||||
// default: 1m x 1m space, 0.75m high in seated position
|
||||
state.mStageSize.width = 1.0f;
|
||||
state.mStageSize.height = 1.0f;
|
||||
state.stageSize.width = 1.0f;
|
||||
state.stageSize.height = 1.0f;
|
||||
|
||||
state.mSittingToStandingTransform[0] = 1.0f;
|
||||
state.mSittingToStandingTransform[1] = 0.0f;
|
||||
state.mSittingToStandingTransform[2] = 0.0f;
|
||||
state.mSittingToStandingTransform[3] = 0.0f;
|
||||
state.sittingToStandingTransform[0] = 1.0f;
|
||||
state.sittingToStandingTransform[1] = 0.0f;
|
||||
state.sittingToStandingTransform[2] = 0.0f;
|
||||
state.sittingToStandingTransform[3] = 0.0f;
|
||||
|
||||
state.mSittingToStandingTransform[4] = 0.0f;
|
||||
state.mSittingToStandingTransform[5] = 1.0f;
|
||||
state.mSittingToStandingTransform[6] = 0.0f;
|
||||
state.mSittingToStandingTransform[7] = 0.0f;
|
||||
state.sittingToStandingTransform[4] = 0.0f;
|
||||
state.sittingToStandingTransform[5] = 1.0f;
|
||||
state.sittingToStandingTransform[6] = 0.0f;
|
||||
state.sittingToStandingTransform[7] = 0.0f;
|
||||
|
||||
state.mSittingToStandingTransform[8] = 0.0f;
|
||||
state.mSittingToStandingTransform[9] = 0.0f;
|
||||
state.mSittingToStandingTransform[10] = 1.0f;
|
||||
state.mSittingToStandingTransform[11] = 0.0f;
|
||||
state.sittingToStandingTransform[8] = 0.0f;
|
||||
state.sittingToStandingTransform[9] = 0.0f;
|
||||
state.sittingToStandingTransform[10] = 1.0f;
|
||||
state.sittingToStandingTransform[11] = 0.0f;
|
||||
|
||||
state.mSittingToStandingTransform[12] = 0.0f;
|
||||
state.mSittingToStandingTransform[13] = 0.75f;
|
||||
state.mSittingToStandingTransform[14] = 0.0f;
|
||||
state.mSittingToStandingTransform[15] = 1.0f;
|
||||
state.sittingToStandingTransform[12] = 0.0f;
|
||||
state.sittingToStandingTransform[13] = 0.75f;
|
||||
state.sittingToStandingTransform[14] = 0.0f;
|
||||
state.sittingToStandingTransform[15] = 1.0f;
|
||||
|
||||
gfx::Quaternion rot;
|
||||
|
||||
|
@ -127,12 +127,12 @@ VRDisplayPuppet::~VRDisplayPuppet() {
|
|||
void VRDisplayPuppet::SetDisplayInfo(const VRDisplayInfo& aDisplayInfo) {
|
||||
// We are only interested in the eye and mount info of the display info.
|
||||
VRDisplayState& state = mDisplayInfo.mDisplayState;
|
||||
state.mEyeResolution = aDisplayInfo.mDisplayState.mEyeResolution;
|
||||
state.mIsMounted = aDisplayInfo.mDisplayState.mIsMounted;
|
||||
memcpy(&state.mEyeFOV, &aDisplayInfo.mDisplayState.mEyeFOV,
|
||||
sizeof(state.mEyeFOV[0]) * VRDisplayState::NumEyes);
|
||||
memcpy(&state.mEyeTranslation, &aDisplayInfo.mDisplayState.mEyeTranslation,
|
||||
sizeof(state.mEyeTranslation[0]) * VRDisplayState::NumEyes);
|
||||
state.eyeResolution = aDisplayInfo.mDisplayState.eyeResolution;
|
||||
state.isMounted = aDisplayInfo.mDisplayState.isMounted;
|
||||
memcpy(&state.eyeFOV, &aDisplayInfo.mDisplayState.eyeFOV,
|
||||
sizeof(state.eyeFOV[0]) * VRDisplayState::NumEyes);
|
||||
memcpy(&state.eyeTranslation, &aDisplayInfo.mDisplayState.eyeTranslation,
|
||||
sizeof(state.eyeTranslation[0]) * VRDisplayState::NumEyes);
|
||||
}
|
||||
|
||||
void VRDisplayPuppet::Destroy() { StopPresentation(); }
|
||||
|
@ -552,7 +552,7 @@ bool VRDisplayPuppet::SubmitFrame(
|
|||
|
||||
void VRDisplayPuppet::Refresh() {
|
||||
// We update mIsConneced once per refresh.
|
||||
mDisplayInfo.mDisplayState.mIsConnected = true;
|
||||
mDisplayInfo.mDisplayState.isConnected = true;
|
||||
}
|
||||
|
||||
VRControllerPuppet::VRControllerPuppet(dom::GamepadHand aHand,
|
||||
|
|
|
@ -61,7 +61,7 @@ void VRLayerChild::SubmitFrame(const VRDisplayInfo& aDisplayInfo) {
|
|||
* in the WebGLContext GLScreenBuffer producer. Not doing so causes some
|
||||
* freezes, crashes or other undefined behaviour.
|
||||
*/
|
||||
if (!mThisFrameTexture || aDisplayInfo.mDisplayState.mLastSubmittedFrameId ==
|
||||
if (!mThisFrameTexture || aDisplayInfo.mDisplayState.lastSubmittedFrameId ==
|
||||
mLastSubmittedFrameId) {
|
||||
mThisFrameTexture = mCanvasElement->GetVRFrame();
|
||||
}
|
||||
|
|
|
@ -46,29 +46,29 @@ struct ParamTraits<mozilla::gfx::VRDisplayState> {
|
|||
// this code can be refactored out if we use
|
||||
// shmem between the VR and content process.
|
||||
nsCString displayName;
|
||||
displayName.Assign(aParam.mDisplayName);
|
||||
displayName.Assign(aParam.displayName);
|
||||
WriteParam(aMsg, displayName);
|
||||
WriteParam(aMsg, aParam.mCapabilityFlags);
|
||||
WriteParam(aMsg, aParam.mEyeResolution.width);
|
||||
WriteParam(aMsg, aParam.mEyeResolution.height);
|
||||
WriteParam(aMsg, aParam.mSuppressFrames);
|
||||
WriteParam(aMsg, aParam.mIsConnected);
|
||||
WriteParam(aMsg, aParam.mIsMounted);
|
||||
WriteParam(aMsg, aParam.mStageSize.width);
|
||||
WriteParam(aMsg, aParam.mStageSize.height);
|
||||
WriteParam(aMsg, aParam.mLastSubmittedFrameId);
|
||||
WriteParam(aMsg, aParam.mPresentingGeneration);
|
||||
WriteParam(aMsg, aParam.capabilityFlags);
|
||||
WriteParam(aMsg, aParam.eyeResolution.width);
|
||||
WriteParam(aMsg, aParam.eyeResolution.height);
|
||||
WriteParam(aMsg, aParam.suppressFrames);
|
||||
WriteParam(aMsg, aParam.isConnected);
|
||||
WriteParam(aMsg, aParam.isMounted);
|
||||
WriteParam(aMsg, aParam.stageSize.width);
|
||||
WriteParam(aMsg, aParam.stageSize.height);
|
||||
WriteParam(aMsg, aParam.lastSubmittedFrameId);
|
||||
WriteParam(aMsg, aParam.presentingGeneration);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
// TODO - Should probably memcpy the whole array or
|
||||
// convert Maxtrix4x4 to a POD type and use it
|
||||
// instead
|
||||
WriteParam(aMsg, aParam.mSittingToStandingTransform[i]);
|
||||
WriteParam(aMsg, aParam.sittingToStandingTransform[i]);
|
||||
}
|
||||
for (int i = 0; i < mozilla::gfx::VRDisplayState::NumEyes; i++) {
|
||||
WriteParam(aMsg, aParam.mEyeFOV[i]);
|
||||
WriteParam(aMsg, aParam.mEyeTranslation[i].x);
|
||||
WriteParam(aMsg, aParam.mEyeTranslation[i].y);
|
||||
WriteParam(aMsg, aParam.mEyeTranslation[i].z);
|
||||
WriteParam(aMsg, aParam.eyeFOV[i]);
|
||||
WriteParam(aMsg, aParam.eyeTranslation[i].x);
|
||||
WriteParam(aMsg, aParam.eyeTranslation[i].y);
|
||||
WriteParam(aMsg, aParam.eyeTranslation[i].z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,30 +76,30 @@ struct ParamTraits<mozilla::gfx::VRDisplayState> {
|
|||
paramType* aResult) {
|
||||
nsCString displayName;
|
||||
if (!ReadParam(aMsg, aIter, &(displayName)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mCapabilityFlags)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mEyeResolution.width)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mEyeResolution.height)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mSuppressFrames)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mIsConnected)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mIsMounted)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mStageSize.width)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mStageSize.height)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLastSubmittedFrameId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPresentingGeneration))) {
|
||||
!ReadParam(aMsg, aIter, &(aResult->capabilityFlags)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->eyeResolution.width)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->eyeResolution.height)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->suppressFrames)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->isConnected)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->isMounted)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->stageSize.width)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->stageSize.height)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->lastSubmittedFrameId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->presentingGeneration))) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mSittingToStandingTransform[i]))) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->sittingToStandingTransform[i]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
strncpy(aResult->mDisplayName, displayName.BeginReading(),
|
||||
strncpy(aResult->displayName, displayName.BeginReading(),
|
||||
mozilla::gfx::kVRDisplayNameMaxLen);
|
||||
for (int i = 0; i < mozilla::gfx::VRDisplayState::NumEyes; i++) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mEyeFOV[i])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mEyeTranslation[i].x)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mEyeTranslation[i].y)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mEyeTranslation[i].z))) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->eyeFOV[i])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->eyeTranslation[i].x)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->eyeTranslation[i].y)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->eyeTranslation[i].z))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -336,17 +336,17 @@ void OSVRSession::InitializeDisplay() {
|
|||
|
||||
bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
|
||||
VRDisplayState& state = aSystemState.displayState;
|
||||
strncpy(state.mDisplayName, "OSVR HMD", kVRDisplayNameMaxLen);
|
||||
state.mEightCC = GFX_VR_EIGHTCC('O', 'S', 'V', 'R', ' ', ' ', ' ', ' ');
|
||||
state.mIsConnected = true;
|
||||
state.mIsMounted = false;
|
||||
state.mCapabilityFlags = (VRDisplayCapabilityFlags)(
|
||||
strncpy(state.displayName, "OSVR HMD", kVRDisplayNameMaxLen);
|
||||
state.eightCC = GFX_VR_EIGHTCC('O', 'S', 'V', 'R', ' ', ' ', ' ', ' ');
|
||||
state.isConnected = true;
|
||||
state.isMounted = false;
|
||||
state.capabilityFlags = (VRDisplayCapabilityFlags)(
|
||||
(int)VRDisplayCapabilityFlags::Cap_None |
|
||||
(int)VRDisplayCapabilityFlags::Cap_Orientation |
|
||||
(int)VRDisplayCapabilityFlags::Cap_Position |
|
||||
(int)VRDisplayCapabilityFlags::Cap_External |
|
||||
(int)VRDisplayCapabilityFlags::Cap_Present);
|
||||
state.mReportsDroppedFrames = false;
|
||||
state.reportsDroppedFrames = false;
|
||||
|
||||
// XXX OSVR display topology allows for more than one viewer
|
||||
// will assume only one viewer for now (most likely stay that way)
|
||||
|
@ -359,7 +359,7 @@ bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
|
|||
// XXX for now there is only one surface per eye
|
||||
osvr_ClientGetViewerEyeSurfaceProjectionClippingPlanes(
|
||||
m_display, 0, eye, 0, &left, &right, &bottom, &top);
|
||||
state.mEyeFOV[eye] = SetFromTanRadians(-left, right, -bottom, top);
|
||||
state.eyeFOV[eye] = SetFromTanRadians(-left, right, -bottom, top);
|
||||
}
|
||||
|
||||
// XXX Assuming there is only one display input for now
|
||||
|
@ -371,8 +371,8 @@ bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
|
|||
OSVR_ViewportDimension l, b, w, h;
|
||||
osvr_ClientGetRelativeViewportForViewerEyeSurface(m_display, 0, eye, 0, &l,
|
||||
&b, &w, &h);
|
||||
state.mEyeResolution.width = w;
|
||||
state.mEyeResolution.height = h;
|
||||
state.eyeResolution.width = w;
|
||||
state.eyeResolution.height = h;
|
||||
OSVR_Pose3 eyePose;
|
||||
// Viewer eye pose may not be immediately available, update client context
|
||||
// until we get it
|
||||
|
@ -382,9 +382,9 @@ bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
|
|||
osvr_ClientUpdate(m_ctx);
|
||||
ret = osvr_ClientGetViewerEyePose(m_display, 0, eye, &eyePose);
|
||||
}
|
||||
state.mEyeTranslation[eye].x = eyePose.translation.data[0];
|
||||
state.mEyeTranslation[eye].y = eyePose.translation.data[1];
|
||||
state.mEyeTranslation[eye].z = eyePose.translation.data[2];
|
||||
state.eyeTranslation[eye].x = eyePose.translation.data[0];
|
||||
state.eyeTranslation[eye].y = eyePose.translation.data[1];
|
||||
state.eyeTranslation[eye].z = eyePose.translation.data[2];
|
||||
|
||||
Matrix4x4 pose;
|
||||
pose.SetRotationFromQuaternion(gfx::Quaternion(
|
||||
|
|
|
@ -156,10 +156,10 @@ ovrButton OculusControllerButtons[2][kNumOculusButtons] = {
|
|||
};
|
||||
|
||||
ovrTouch OculusControllerTouches[2][kNumOculusButtons] = {
|
||||
{ovrTouch_LThumb, ovrTouch_LIndexTrigger, (ovrTouch)0, ovrTouch_X, ovrTouch_Y,
|
||||
ovrTouch_LThumbRest},
|
||||
{ovrTouch_RThumb, ovrTouch_RIndexTrigger, (ovrTouch)0, ovrTouch_A, ovrTouch_B,
|
||||
ovrTouch_RThumbRest},
|
||||
{ovrTouch_LThumb, ovrTouch_LIndexTrigger, (ovrTouch)0, ovrTouch_X,
|
||||
ovrTouch_Y, ovrTouch_LThumbRest},
|
||||
{ovrTouch_RThumb, ovrTouch_RIndexTrigger, (ovrTouch)0, ovrTouch_A,
|
||||
ovrTouch_B, ovrTouch_RThumbRest},
|
||||
};
|
||||
|
||||
void UpdateButton(const ovrInputState& aInputState, uint32_t aHandIdx,
|
||||
|
@ -227,9 +227,8 @@ bool OculusSession::Initialize(mozilla::gfx::VRSystemState& aSystemState) {
|
|||
return false;
|
||||
}
|
||||
|
||||
mPresentationSize =
|
||||
IntSize(aSystemState.displayState.mEyeResolution.width * 2,
|
||||
aSystemState.displayState.mEyeResolution.height);
|
||||
mPresentationSize = IntSize(aSystemState.displayState.eyeResolution.width * 2,
|
||||
aSystemState.displayState.eyeResolution.height);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -328,13 +327,13 @@ void OculusSession::ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) {
|
|||
|
||||
ovrSessionStatus status;
|
||||
if (OVR_SUCCESS(ovr_GetSessionStatus(mSession, &status))) {
|
||||
aSystemState.displayState.mIsConnected = status.HmdPresent;
|
||||
aSystemState.displayState.mIsMounted = status.HmdMounted;
|
||||
aSystemState.displayState.isConnected = status.HmdPresent;
|
||||
aSystemState.displayState.isMounted = status.HmdMounted;
|
||||
mShouldQuit = status.ShouldQuit;
|
||||
|
||||
} else {
|
||||
aSystemState.displayState.mIsConnected = false;
|
||||
aSystemState.displayState.mIsMounted = false;
|
||||
aSystemState.displayState.isConnected = false;
|
||||
aSystemState.displayState.isMounted = false;
|
||||
}
|
||||
UpdateHaptics();
|
||||
UpdateVisibility();
|
||||
|
@ -482,14 +481,14 @@ bool OculusSession::SubmitFrame(
|
|||
layer.ColorTexture[1] = nullptr;
|
||||
layer.Fov[0] = mFOVPort[0];
|
||||
layer.Fov[1] = mFOVPort[1];
|
||||
layer.Viewport[0].Pos.x = textureDesc.Width * aLayer.mLeftEyeRect.x;
|
||||
layer.Viewport[0].Pos.y = textureDesc.Height * aLayer.mLeftEyeRect.y;
|
||||
layer.Viewport[0].Size.w = textureDesc.Width * aLayer.mLeftEyeRect.width;
|
||||
layer.Viewport[0].Size.h = textureDesc.Height * aLayer.mLeftEyeRect.height;
|
||||
layer.Viewport[1].Pos.x = textureDesc.Width * aLayer.mRightEyeRect.x;
|
||||
layer.Viewport[1].Pos.y = textureDesc.Height * aLayer.mRightEyeRect.y;
|
||||
layer.Viewport[1].Size.w = textureDesc.Width * aLayer.mRightEyeRect.width;
|
||||
layer.Viewport[1].Size.h = textureDesc.Height * aLayer.mRightEyeRect.height;
|
||||
layer.Viewport[0].Pos.x = textureDesc.Width * aLayer.leftEyeRect.x;
|
||||
layer.Viewport[0].Pos.y = textureDesc.Height * aLayer.leftEyeRect.y;
|
||||
layer.Viewport[0].Size.w = textureDesc.Width * aLayer.leftEyeRect.width;
|
||||
layer.Viewport[0].Size.h = textureDesc.Height * aLayer.leftEyeRect.height;
|
||||
layer.Viewport[1].Pos.x = textureDesc.Width * aLayer.rightEyeRect.x;
|
||||
layer.Viewport[1].Pos.y = textureDesc.Height * aLayer.rightEyeRect.y;
|
||||
layer.Viewport[1].Size.w = textureDesc.Width * aLayer.rightEyeRect.width;
|
||||
layer.Viewport[1].Size.h = textureDesc.Height * aLayer.rightEyeRect.height;
|
||||
|
||||
for (uint32_t i = 0; i < 2; ++i) {
|
||||
layer.RenderPose[i].Orientation.x = mFrameStartPose[i].Orientation.x;
|
||||
|
@ -981,33 +980,33 @@ void OculusSession::StopRendering() {
|
|||
|
||||
bool OculusSession::InitState(VRSystemState& aSystemState) {
|
||||
VRDisplayState& state = aSystemState.displayState;
|
||||
strncpy(state.mDisplayName, "Oculus VR HMD", kVRDisplayNameMaxLen);
|
||||
state.mIsConnected = true;
|
||||
state.mIsMounted = false;
|
||||
strncpy(state.displayName, "Oculus VR HMD", kVRDisplayNameMaxLen);
|
||||
state.isConnected = true;
|
||||
state.isMounted = false;
|
||||
|
||||
ovrHmdDesc desc = ovr_GetHmdDesc(mSession);
|
||||
|
||||
state.mCapabilityFlags = VRDisplayCapabilityFlags::Cap_None;
|
||||
state.capabilityFlags = VRDisplayCapabilityFlags::Cap_None;
|
||||
if (desc.AvailableTrackingCaps & ovrTrackingCap_Orientation) {
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_Orientation;
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_AngularAcceleration;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_Orientation;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_AngularAcceleration;
|
||||
}
|
||||
if (desc.AvailableTrackingCaps & ovrTrackingCap_Position) {
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_Position;
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_LinearAcceleration;
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_StageParameters;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_Position;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_LinearAcceleration;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_StageParameters;
|
||||
}
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_External;
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_MountDetection;
|
||||
state.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_Present;
|
||||
state.mReportsDroppedFrames = true;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_External;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_MountDetection;
|
||||
state.capabilityFlags |= VRDisplayCapabilityFlags::Cap_Present;
|
||||
state.reportsDroppedFrames = true;
|
||||
|
||||
mFOVPort[VRDisplayState::Eye_Left] = desc.DefaultEyeFov[ovrEye_Left];
|
||||
mFOVPort[VRDisplayState::Eye_Right] = desc.DefaultEyeFov[ovrEye_Right];
|
||||
|
||||
state.mEyeFOV[VRDisplayState::Eye_Left] =
|
||||
state.eyeFOV[VRDisplayState::Eye_Left] =
|
||||
FromFovPort(mFOVPort[VRDisplayState::Eye_Left]);
|
||||
state.mEyeFOV[VRDisplayState::Eye_Right] =
|
||||
state.eyeFOV[VRDisplayState::Eye_Right] =
|
||||
FromFovPort(mFOVPort[VRDisplayState::Eye_Right]);
|
||||
|
||||
float pixelsPerDisplayPixel = 1.0;
|
||||
|
@ -1020,10 +1019,10 @@ bool OculusSession::InitState(VRSystemState& aSystemState) {
|
|||
}
|
||||
|
||||
// take the max of both for eye resolution
|
||||
state.mEyeResolution.width = std::max(texSize[VRDisplayState::Eye_Left].w,
|
||||
texSize[VRDisplayState::Eye_Right].w);
|
||||
state.mEyeResolution.height = std::max(texSize[VRDisplayState::Eye_Left].h,
|
||||
texSize[VRDisplayState::Eye_Right].h);
|
||||
state.eyeResolution.width = std::max(texSize[VRDisplayState::Eye_Left].w,
|
||||
texSize[VRDisplayState::Eye_Right].w);
|
||||
state.eyeResolution.height = std::max(texSize[VRDisplayState::Eye_Left].h,
|
||||
texSize[VRDisplayState::Eye_Right].h);
|
||||
|
||||
// default to an identity quaternion
|
||||
aSystemState.sensorState.pose.orientation[3] = 1.0f;
|
||||
|
@ -1045,37 +1044,37 @@ void OculusSession::UpdateStageParameters(VRDisplayState& aState) {
|
|||
ovrResult res =
|
||||
ovr_GetBoundaryDimensions(mSession, ovrBoundary_PlayArea, &playArea);
|
||||
if (res == ovrSuccess) {
|
||||
aState.mStageSize.width = playArea.x;
|
||||
aState.mStageSize.height = playArea.z;
|
||||
aState.stageSize.width = playArea.x;
|
||||
aState.stageSize.height = playArea.z;
|
||||
} else {
|
||||
// If we fail, fall back to reasonable defaults.
|
||||
// 1m x 1m space
|
||||
aState.mStageSize.width = 1.0f;
|
||||
aState.mStageSize.height = 1.0f;
|
||||
aState.stageSize.width = 1.0f;
|
||||
aState.stageSize.height = 1.0f;
|
||||
}
|
||||
|
||||
float eyeHeight =
|
||||
ovr_GetFloat(mSession, OVR_KEY_EYE_HEIGHT, OVR_DEFAULT_EYE_HEIGHT);
|
||||
|
||||
aState.mSittingToStandingTransform[0] = 1.0f;
|
||||
aState.mSittingToStandingTransform[1] = 0.0f;
|
||||
aState.mSittingToStandingTransform[2] = 0.0f;
|
||||
aState.mSittingToStandingTransform[3] = 0.0f;
|
||||
aState.sittingToStandingTransform[0] = 1.0f;
|
||||
aState.sittingToStandingTransform[1] = 0.0f;
|
||||
aState.sittingToStandingTransform[2] = 0.0f;
|
||||
aState.sittingToStandingTransform[3] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[4] = 0.0f;
|
||||
aState.mSittingToStandingTransform[5] = 1.0f;
|
||||
aState.mSittingToStandingTransform[6] = 0.0f;
|
||||
aState.mSittingToStandingTransform[7] = 0.0f;
|
||||
aState.sittingToStandingTransform[4] = 0.0f;
|
||||
aState.sittingToStandingTransform[5] = 1.0f;
|
||||
aState.sittingToStandingTransform[6] = 0.0f;
|
||||
aState.sittingToStandingTransform[7] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[8] = 0.0f;
|
||||
aState.mSittingToStandingTransform[9] = 0.0f;
|
||||
aState.mSittingToStandingTransform[10] = 1.0f;
|
||||
aState.mSittingToStandingTransform[11] = 0.0f;
|
||||
aState.sittingToStandingTransform[8] = 0.0f;
|
||||
aState.sittingToStandingTransform[9] = 0.0f;
|
||||
aState.sittingToStandingTransform[10] = 1.0f;
|
||||
aState.sittingToStandingTransform[11] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[12] = 0.0f;
|
||||
aState.mSittingToStandingTransform[13] = eyeHeight;
|
||||
aState.mSittingToStandingTransform[14] = 0.0f;
|
||||
aState.mSittingToStandingTransform[15] = 1.0f;
|
||||
aState.sittingToStandingTransform[12] = 0.0f;
|
||||
aState.sittingToStandingTransform[13] = eyeHeight;
|
||||
aState.sittingToStandingTransform[14] = 0.0f;
|
||||
aState.sittingToStandingTransform[15] = 1.0f;
|
||||
}
|
||||
|
||||
void OculusSession::UpdateEyeParameters(VRSystemState& aState) {
|
||||
|
@ -1092,11 +1091,11 @@ void OculusSession::UpdateEyeParameters(VRSystemState& aState) {
|
|||
// loading the Oculus runtime dll directly.
|
||||
ovrEyeRenderDesc renderDesc =
|
||||
ovr_GetRenderDesc2(mSession, (ovrEyeType)eye, mFOVPort[eye]);
|
||||
aState.displayState.mEyeTranslation[eye].x =
|
||||
aState.displayState.eyeTranslation[eye].x =
|
||||
renderDesc.HmdToEyePose.Position.x;
|
||||
aState.displayState.mEyeTranslation[eye].y =
|
||||
aState.displayState.eyeTranslation[eye].y =
|
||||
renderDesc.HmdToEyePose.Position.y;
|
||||
aState.displayState.mEyeTranslation[eye].z =
|
||||
aState.displayState.eyeTranslation[eye].z =
|
||||
renderDesc.HmdToEyePose.Position.z;
|
||||
|
||||
Matrix4x4 pose;
|
||||
|
@ -1372,7 +1371,7 @@ void OculusSession::UpdateTelemetry(VRSystemState& aSystemState) {
|
|||
ovrPerfStats perfStats;
|
||||
if (ovr_GetPerfStats(mSession, &perfStats) == ovrSuccess) {
|
||||
if (perfStats.FrameStatsCount) {
|
||||
aSystemState.displayState.mDroppedFrameCount =
|
||||
aSystemState.displayState.droppedFrameCount =
|
||||
perfStats.FrameStats[0].AppDroppedFrameCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -745,34 +745,34 @@ void OpenVRSession::Shutdown() {
|
|||
|
||||
bool OpenVRSession::InitState(VRSystemState& aSystemState) {
|
||||
VRDisplayState& state = aSystemState.displayState;
|
||||
strncpy(state.mDisplayName, "OpenVR HMD", kVRDisplayNameMaxLen);
|
||||
state.mEightCC = GFX_VR_EIGHTCC('O', 'p', 'e', 'n', 'V', 'R', ' ', ' ');
|
||||
state.mIsConnected =
|
||||
strncpy(state.displayName, "OpenVR HMD", kVRDisplayNameMaxLen);
|
||||
state.eightCC = GFX_VR_EIGHTCC('O', 'p', 'e', 'n', 'V', 'R', ' ', ' ');
|
||||
state.isConnected =
|
||||
mVRSystem->IsTrackedDeviceConnected(::vr::k_unTrackedDeviceIndex_Hmd);
|
||||
state.mIsMounted = false;
|
||||
state.mCapabilityFlags = (VRDisplayCapabilityFlags)(
|
||||
state.isMounted = false;
|
||||
state.capabilityFlags = (VRDisplayCapabilityFlags)(
|
||||
(int)VRDisplayCapabilityFlags::Cap_None |
|
||||
(int)VRDisplayCapabilityFlags::Cap_Orientation |
|
||||
(int)VRDisplayCapabilityFlags::Cap_Position |
|
||||
(int)VRDisplayCapabilityFlags::Cap_External |
|
||||
(int)VRDisplayCapabilityFlags::Cap_Present |
|
||||
(int)VRDisplayCapabilityFlags::Cap_StageParameters);
|
||||
state.mReportsDroppedFrames = true;
|
||||
state.reportsDroppedFrames = true;
|
||||
|
||||
::vr::ETrackedPropertyError err;
|
||||
bool bHasProximitySensor = mVRSystem->GetBoolTrackedDeviceProperty(
|
||||
::vr::k_unTrackedDeviceIndex_Hmd, ::vr::Prop_ContainsProximitySensor_Bool,
|
||||
&err);
|
||||
if (err == ::vr::TrackedProp_Success && bHasProximitySensor) {
|
||||
state.mCapabilityFlags = (VRDisplayCapabilityFlags)(
|
||||
(int)state.mCapabilityFlags |
|
||||
state.capabilityFlags = (VRDisplayCapabilityFlags)(
|
||||
(int)state.capabilityFlags |
|
||||
(int)VRDisplayCapabilityFlags::Cap_MountDetection);
|
||||
}
|
||||
|
||||
uint32_t w, h;
|
||||
mVRSystem->GetRecommendedRenderTargetSize(&w, &h);
|
||||
state.mEyeResolution.width = w;
|
||||
state.mEyeResolution.height = h;
|
||||
state.eyeResolution.width = w;
|
||||
state.eyeResolution.height = h;
|
||||
|
||||
// default to an identity quaternion
|
||||
aSystemState.sensorState.pose.orientation[3] = 1.0f;
|
||||
|
@ -795,53 +795,53 @@ void OpenVRSession::UpdateStageParameters(VRDisplayState& aState) {
|
|||
if (mVRChaperone->GetPlayAreaSize(&sizeX, &sizeZ)) {
|
||||
::vr::HmdMatrix34_t t =
|
||||
mVRSystem->GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
|
||||
aState.mStageSize.width = sizeX;
|
||||
aState.mStageSize.height = sizeZ;
|
||||
aState.stageSize.width = sizeX;
|
||||
aState.stageSize.height = sizeZ;
|
||||
|
||||
aState.mSittingToStandingTransform[0] = t.m[0][0];
|
||||
aState.mSittingToStandingTransform[1] = t.m[1][0];
|
||||
aState.mSittingToStandingTransform[2] = t.m[2][0];
|
||||
aState.mSittingToStandingTransform[3] = 0.0f;
|
||||
aState.sittingToStandingTransform[0] = t.m[0][0];
|
||||
aState.sittingToStandingTransform[1] = t.m[1][0];
|
||||
aState.sittingToStandingTransform[2] = t.m[2][0];
|
||||
aState.sittingToStandingTransform[3] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[4] = t.m[0][1];
|
||||
aState.mSittingToStandingTransform[5] = t.m[1][1];
|
||||
aState.mSittingToStandingTransform[6] = t.m[2][1];
|
||||
aState.mSittingToStandingTransform[7] = 0.0f;
|
||||
aState.sittingToStandingTransform[4] = t.m[0][1];
|
||||
aState.sittingToStandingTransform[5] = t.m[1][1];
|
||||
aState.sittingToStandingTransform[6] = t.m[2][1];
|
||||
aState.sittingToStandingTransform[7] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[8] = t.m[0][2];
|
||||
aState.mSittingToStandingTransform[9] = t.m[1][2];
|
||||
aState.mSittingToStandingTransform[10] = t.m[2][2];
|
||||
aState.mSittingToStandingTransform[11] = 0.0f;
|
||||
aState.sittingToStandingTransform[8] = t.m[0][2];
|
||||
aState.sittingToStandingTransform[9] = t.m[1][2];
|
||||
aState.sittingToStandingTransform[10] = t.m[2][2];
|
||||
aState.sittingToStandingTransform[11] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[12] = t.m[0][3];
|
||||
aState.mSittingToStandingTransform[13] = t.m[1][3];
|
||||
aState.mSittingToStandingTransform[14] = t.m[2][3];
|
||||
aState.mSittingToStandingTransform[15] = 1.0f;
|
||||
aState.sittingToStandingTransform[12] = t.m[0][3];
|
||||
aState.sittingToStandingTransform[13] = t.m[1][3];
|
||||
aState.sittingToStandingTransform[14] = t.m[2][3];
|
||||
aState.sittingToStandingTransform[15] = 1.0f;
|
||||
} else {
|
||||
// If we fail, fall back to reasonable defaults.
|
||||
// 1m x 1m space, 0.75m high in seated position
|
||||
aState.mStageSize.width = 1.0f;
|
||||
aState.mStageSize.height = 1.0f;
|
||||
aState.stageSize.width = 1.0f;
|
||||
aState.stageSize.height = 1.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[0] = 1.0f;
|
||||
aState.mSittingToStandingTransform[1] = 0.0f;
|
||||
aState.mSittingToStandingTransform[2] = 0.0f;
|
||||
aState.mSittingToStandingTransform[3] = 0.0f;
|
||||
aState.sittingToStandingTransform[0] = 1.0f;
|
||||
aState.sittingToStandingTransform[1] = 0.0f;
|
||||
aState.sittingToStandingTransform[2] = 0.0f;
|
||||
aState.sittingToStandingTransform[3] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[4] = 0.0f;
|
||||
aState.mSittingToStandingTransform[5] = 1.0f;
|
||||
aState.mSittingToStandingTransform[6] = 0.0f;
|
||||
aState.mSittingToStandingTransform[7] = 0.0f;
|
||||
aState.sittingToStandingTransform[4] = 0.0f;
|
||||
aState.sittingToStandingTransform[5] = 1.0f;
|
||||
aState.sittingToStandingTransform[6] = 0.0f;
|
||||
aState.sittingToStandingTransform[7] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[8] = 0.0f;
|
||||
aState.mSittingToStandingTransform[9] = 0.0f;
|
||||
aState.mSittingToStandingTransform[10] = 1.0f;
|
||||
aState.mSittingToStandingTransform[11] = 0.0f;
|
||||
aState.sittingToStandingTransform[8] = 0.0f;
|
||||
aState.sittingToStandingTransform[9] = 0.0f;
|
||||
aState.sittingToStandingTransform[10] = 1.0f;
|
||||
aState.sittingToStandingTransform[11] = 0.0f;
|
||||
|
||||
aState.mSittingToStandingTransform[12] = 0.0f;
|
||||
aState.mSittingToStandingTransform[13] = 0.75f;
|
||||
aState.mSittingToStandingTransform[14] = 0.0f;
|
||||
aState.mSittingToStandingTransform[15] = 1.0f;
|
||||
aState.sittingToStandingTransform[12] = 0.0f;
|
||||
aState.sittingToStandingTransform[13] = 0.75f;
|
||||
aState.sittingToStandingTransform[14] = 0.0f;
|
||||
aState.sittingToStandingTransform[15] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -853,17 +853,17 @@ void OpenVRSession::UpdateEyeParameters(VRSystemState& aState) {
|
|||
for (uint32_t eye = 0; eye < 2; ++eye) {
|
||||
::vr::HmdMatrix34_t eyeToHead =
|
||||
mVRSystem->GetEyeToHeadTransform(static_cast<::vr::Hmd_Eye>(eye));
|
||||
aState.displayState.mEyeTranslation[eye].x = eyeToHead.m[0][3];
|
||||
aState.displayState.mEyeTranslation[eye].y = eyeToHead.m[1][3];
|
||||
aState.displayState.mEyeTranslation[eye].z = eyeToHead.m[2][3];
|
||||
aState.displayState.eyeTranslation[eye].x = eyeToHead.m[0][3];
|
||||
aState.displayState.eyeTranslation[eye].y = eyeToHead.m[1][3];
|
||||
aState.displayState.eyeTranslation[eye].z = eyeToHead.m[2][3];
|
||||
|
||||
float left, right, up, down;
|
||||
mVRSystem->GetProjectionRaw(static_cast<::vr::Hmd_Eye>(eye), &left, &right,
|
||||
&up, &down);
|
||||
aState.displayState.mEyeFOV[eye].upDegrees = atan(-up) * 180.0 / M_PI;
|
||||
aState.displayState.mEyeFOV[eye].rightDegrees = atan(right) * 180.0 / M_PI;
|
||||
aState.displayState.mEyeFOV[eye].downDegrees = atan(down) * 180.0 / M_PI;
|
||||
aState.displayState.mEyeFOV[eye].leftDegrees = atan(-left) * 180.0 / M_PI;
|
||||
aState.displayState.eyeFOV[eye].upDegrees = atan(-up) * 180.0 / M_PI;
|
||||
aState.displayState.eyeFOV[eye].rightDegrees = atan(right) * 180.0 / M_PI;
|
||||
aState.displayState.eyeFOV[eye].downDegrees = atan(down) * 180.0 / M_PI;
|
||||
aState.displayState.eyeFOV[eye].leftDegrees = atan(-left) * 180.0 / M_PI;
|
||||
|
||||
Matrix4x4 pose;
|
||||
// NOTE! eyeToHead.m is a 3x4 matrix, not 4x4. But
|
||||
|
@ -1893,22 +1893,22 @@ void OpenVRSession::ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) {
|
|||
switch (event.eventType) {
|
||||
case ::vr::VREvent_TrackedDeviceUserInteractionStarted:
|
||||
if (event.trackedDeviceIndex == ::vr::k_unTrackedDeviceIndex_Hmd) {
|
||||
aSystemState.displayState.mIsMounted = true;
|
||||
aSystemState.displayState.isMounted = true;
|
||||
}
|
||||
break;
|
||||
case ::vr::VREvent_TrackedDeviceUserInteractionEnded:
|
||||
if (event.trackedDeviceIndex == ::vr::k_unTrackedDeviceIndex_Hmd) {
|
||||
aSystemState.displayState.mIsMounted = false;
|
||||
aSystemState.displayState.isMounted = false;
|
||||
}
|
||||
break;
|
||||
case ::vr::EVREventType::VREvent_TrackedDeviceActivated:
|
||||
if (event.trackedDeviceIndex == ::vr::k_unTrackedDeviceIndex_Hmd) {
|
||||
aSystemState.displayState.mIsConnected = true;
|
||||
aSystemState.displayState.isConnected = true;
|
||||
}
|
||||
break;
|
||||
case ::vr::EVREventType::VREvent_TrackedDeviceDeactivated:
|
||||
if (event.trackedDeviceIndex == ::vr::k_unTrackedDeviceIndex_Hmd) {
|
||||
aSystemState.displayState.mIsConnected = false;
|
||||
aSystemState.displayState.isConnected = false;
|
||||
}
|
||||
break;
|
||||
case ::vr::EVREventType::VREvent_DriverRequestedQuit:
|
||||
|
@ -1933,14 +1933,14 @@ bool OpenVRSession::SubmitFrame(
|
|||
const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
|
||||
ID3D11Texture2D* aTexture) {
|
||||
return SubmitFrame((void*)aTexture, ::vr::ETextureType::TextureType_DirectX,
|
||||
aLayer.mLeftEyeRect, aLayer.mRightEyeRect);
|
||||
aLayer.leftEyeRect, aLayer.rightEyeRect);
|
||||
}
|
||||
#elif defined(XP_MACOSX)
|
||||
bool OpenVRSession::SubmitFrame(
|
||||
const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
|
||||
const VRLayerTextureHandle& aTexture) {
|
||||
return SubmitFrame(aTexture, ::vr::ETextureType::TextureType_IOSurface,
|
||||
aLayer.mLeftEyeRect, aLayer.mRightEyeRect);
|
||||
aLayer.leftEyeRect, aLayer.rightEyeRect);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2190,7 +2190,7 @@ void OpenVRSession::UpdateTelemetry(VRSystemState& aSystemState) {
|
|||
::vr::Compositor_CumulativeStats stats;
|
||||
mVRCompositor->GetCumulativeStats(&stats,
|
||||
sizeof(::vr::Compositor_CumulativeStats));
|
||||
aSystemState.displayState.mDroppedFrameCount = stats.m_nNumReprojectedFrames;
|
||||
aSystemState.displayState.droppedFrameCount = stats.m_nNumReprojectedFrames;
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace {
|
|||
int64_t FrameIDFromBrowserState(const mozilla::gfx::VRBrowserState& aState) {
|
||||
for (const auto& layer : aState.layerState) {
|
||||
if (layer.type == VRLayerType::LayerType_Stereo_Immersive) {
|
||||
return layer.layer_stereo_immersive.mFrameId;
|
||||
return layer.layer_stereo_immersive.frameId;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -261,7 +261,7 @@ void VRService::ServiceInitialize() {
|
|||
// other fields remaining zeroed out.
|
||||
memset(&mSystemState, 0, sizeof(mSystemState));
|
||||
mSystemState.enumerationCompleted = true;
|
||||
mSystemState.displayState.mMinRestartInterval =
|
||||
mSystemState.displayState.minRestartInterval =
|
||||
gfxPrefs::VRExternalNotDetectedTimeout();
|
||||
mSystemState.displayState.shutdown = true;
|
||||
PushState(mSystemState);
|
||||
|
@ -278,7 +278,7 @@ void VRService::ServiceShutdown() {
|
|||
mSystemState.enumerationCompleted = true;
|
||||
mSystemState.displayState.shutdown = true;
|
||||
if (mSession && mSession->ShouldQuit()) {
|
||||
mSystemState.displayState.mMinRestartInterval =
|
||||
mSystemState.displayState.minRestartInterval =
|
||||
gfxPrefs::VRExternalQuitTimeout();
|
||||
}
|
||||
PushState(mSystemState);
|
||||
|
@ -341,7 +341,7 @@ void VRService::ServiceImmersiveMode() {
|
|||
}
|
||||
|
||||
uint64_t newFrameId = FrameIDFromBrowserState(mBrowserState);
|
||||
if (newFrameId != mSystemState.displayState.mLastSubmittedFrameId) {
|
||||
if (newFrameId != mSystemState.displayState.lastSubmittedFrameId) {
|
||||
// A new immersive frame has been received.
|
||||
// Submit the textures to the VR system compositor.
|
||||
bool success = false;
|
||||
|
@ -358,8 +358,8 @@ void VRService::ServiceImmersiveMode() {
|
|||
// rendering. Changes to mLastSubmittedFrameId and the values
|
||||
// used for rendering, such as headset pose, must be pushed
|
||||
// atomically to the browser.
|
||||
mSystemState.displayState.mLastSubmittedFrameId = newFrameId;
|
||||
mSystemState.displayState.mLastSubmittedFrameSuccessful = success;
|
||||
mSystemState.displayState.lastSubmittedFrameId = newFrameId;
|
||||
mSystemState.displayState.lastSubmittedFrameSuccessful = success;
|
||||
|
||||
// StartFrame may block to control the timing for the next frame start
|
||||
mSession->StartFrame(mSystemState);
|
||||
|
|
|
@ -60,11 +60,11 @@ bool VRSession::SubmitFrame(
|
|||
const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer) {
|
||||
#if defined(XP_WIN)
|
||||
|
||||
if (aLayer.mTextureType ==
|
||||
if (aLayer.textureType ==
|
||||
VRLayerTextureType::LayerTextureType_D3D10SurfaceDescriptor) {
|
||||
RefPtr<ID3D11Texture2D> dxTexture;
|
||||
HRESULT hr = mDevice->OpenSharedResource(
|
||||
(HANDLE)aLayer.mTextureHandle, __uuidof(ID3D11Texture2D),
|
||||
(HANDLE)aLayer.textureHandle, __uuidof(ID3D11Texture2D),
|
||||
(void**)(ID3D11Texture2D**)getter_AddRefs(dxTexture));
|
||||
if (FAILED(hr) || !dxTexture) {
|
||||
NS_WARNING("Failed to open shared texture");
|
||||
|
@ -101,9 +101,8 @@ bool VRSession::SubmitFrame(
|
|||
|
||||
#elif defined(XP_MACOSX)
|
||||
|
||||
if (aLayer.mTextureType ==
|
||||
VRLayerTextureType::LayerTextureType_MacIOSurface) {
|
||||
return SubmitFrame(aLayer, aLayer.mTextureHandle);
|
||||
if (aLayer.textureType == VRLayerTextureType::LayerTextureType_MacIOSurface) {
|
||||
return SubmitFrame(aLayer, aLayer.textureHandle);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче