Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Add WebXR related cap flags to device delegates #2516

Merged
merged 1 commit into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/src/googlevr/cpp/DeviceDelegateGoogleVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ DeviceDelegateGoogleVR::RegisterImmersiveDisplay(ImmersiveDisplayPtr aDisplay) {
}

m.immersiveDisplay->SetDeviceName("Daydream");
m.immersiveDisplay->SetCapabilityFlags(device::Position | device::Orientation | device::Present | device::StageParameters);
m.immersiveDisplay->SetCapabilityFlags(device::Position | device::Orientation | device::Present | device::StageParameters |
device::InlineSession | device::ImmersiveVRSession);
m.immersiveDisplay->SetSittingToStandingTransform(vrb::Matrix::Translation(kAverageHeight));
gvr_sizei size = m.GetRecommendedImmersiveModeSize();
m.immersiveDisplay->SetEyeResolution(size.width / 2, size.height);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/cpp/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const CapabilityFlags LinearAcceleration = 1u << 6u;
const CapabilityFlags StageParameters = 1u << 7u;
const CapabilityFlags MountDetection = 1u << 8u;
const CapabilityFlags PositionEmulated = 1u << 9u;
const CapabilityFlags InlineSession = 1u << 10u;
const CapabilityFlags ImmersiveVRSession = 1u << 11u;
const CapabilityFlags ImmersiveARSession = 1u << 12u;
enum class Eye { Left, Right };
enum class RenderMode { StandAlone, Immersive };
enum class CPULevel { Normal = 0, High };
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/cpp/ExternalVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ ExternalVR::SetCapabilityFlags(const device::CapabilityFlags aFlags) {
if (device::PositionEmulated & aFlags) {
result |= static_cast<uint16_t>(mozilla::gfx::VRDisplayCapabilityFlags::Cap_PositionEmulated);
}
if (device::InlineSession & aFlags) {
result |= static_cast<uint16_t>(mozilla::gfx::VRDisplayCapabilityFlags::Cap_Inline);
}
if (device::ImmersiveVRSession & aFlags) {
result |= static_cast<uint16_t>(mozilla::gfx::VRDisplayCapabilityFlags::Cap_ImmersiveVR);
}
if (device::ImmersiveARSession & aFlags) {
result |= static_cast<uint16_t>(mozilla::gfx::VRDisplayCapabilityFlags::Cap_ImmersiveAR);
}
//m.deviceCapabilities = aFlags;
m.system.displayState.capabilityFlags = static_cast<mozilla::gfx::VRDisplayCapabilityFlags>(result);
m.system.sensorState.flags = m.system.displayState.capabilityFlags;
Expand Down
2 changes: 1 addition & 1 deletion app/src/noapi/cpp/DeviceDelegateNoAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct DeviceDelegateNoAPI::State {
display->SetEyeResolution((int32_t)(glWidth / 2), glHeight);
display->SetEyeOffset(device::Eye::Left, 0.0f, 0.0f, 0.0f);
display->SetEyeOffset(device::Eye::Right, 0.0f, 0.0f, 0.0f);
display->SetCapabilityFlags(device::Position | device::Orientation | device::Present);
display->SetCapabilityFlags(device::Position | device::Orientation | device::Present | device::InlineSession | device::ImmersiveVRSession);
}
}
};
Expand Down
3 changes: 2 additions & 1 deletion app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,8 @@ DeviceDelegateOculusVR::StartFrame() {
if (m.immersiveDisplay) {
m.immersiveDisplay->SetEyeOffset(device::Eye::Left, -ipd * 0.5f, 0.f, 0.f);
m.immersiveDisplay->SetEyeOffset(device::Eye::Right, ipd * 0.5f, 0.f, 0.f);
device::CapabilityFlags caps = device::Orientation | device::Present | device::StageParameters;
device::CapabilityFlags caps = device::Orientation | device::Present | device::StageParameters |
device::InlineSession | device::ImmersiveVRSession;
if (m.predictedTracking.Status & VRAPI_TRACKING_STATUS_POSITION_TRACKED) {
caps |= device::Position;
} else {
Expand Down
3 changes: 2 additions & 1 deletion app/src/svr/cpp/DeviceDelegateSVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ DeviceDelegateSVR::RegisterImmersiveDisplay(ImmersiveDisplayPtr aDisplay) {
}

m.immersiveDisplay->SetDeviceName("ODG");
m.immersiveDisplay->SetCapabilityFlags(device::Position | device::Orientation | device::Present);
m.immersiveDisplay->SetCapabilityFlags(device::Position | device::Orientation | device::Present |
device::InlineSession | device::ImmersiveVRSession);
m.immersiveDisplay->SetEyeResolution(m.renderWidth, m.renderHeight);
m.immersiveDisplay->CompleteEnumeration();

Expand Down
3 changes: 2 additions & 1 deletion app/src/wavevr/cpp/DeviceDelegateWaveVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ DeviceDelegateWaveVR::RegisterImmersiveDisplay(ImmersiveDisplayPtr aDisplay) {
}

m.immersiveDisplay->SetDeviceName("Wave");
device::CapabilityFlags flags = device::Orientation | device::Present | device::StageParameters;
device::CapabilityFlags flags = device::Orientation | device::Present | device::StageParameters |
device::InlineSession | device::ImmersiveVRSession;

if (WVR_GetDegreeOfFreedom(WVR_DeviceType_HMD) == WVR_NumDoF_6DoF) {
flags |= device::Position;
Expand Down