|
Lines 70-76
public:
a/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp_sec1
|
| 70 |
~Impl(); |
70 |
~Impl(); |
| 71 |
|
71 |
|
| 72 |
#if USE_OPENXR |
72 |
#if USE_OPENXR |
| 73 |
Optional<Vector<SessionMode>> collectSupportedSessionModes(OpenXRDevice&); |
|
|
| 74 |
XrInstance xrInstance() const { return m_instance; } |
73 |
XrInstance xrInstance() const { return m_instance; } |
| 75 |
#endif |
74 |
#endif |
| 76 |
|
75 |
|
|
Lines 95-102
void Instance::Impl::enumerateApiLayerProperties() const
a/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp_sec2
|
| 95 |
return; |
94 |
return; |
| 96 |
} |
95 |
} |
| 97 |
|
96 |
|
| 98 |
Vector<XrApiLayerProperties> properties(propertyCountOutput); |
97 |
Vector<XrApiLayerProperties> properties(propertyCountOutput, |
| 99 |
result = xrEnumerateApiLayerProperties(propertyCountOutput, nullptr, properties.data()); |
98 |
[] { |
|
|
99 |
XrApiLayerProperties object; |
| 100 |
std::memset(&object, 0, sizeof(XrApiLayerProperties)); |
| 101 |
object.type = XR_TYPE_API_LAYER_PROPERTIES; |
| 102 |
return object; |
| 103 |
}()); |
| 104 |
result = xrEnumerateApiLayerProperties(propertyCountOutput, &propertyCountOutput, properties.data()); |
| 105 |
|
| 100 |
RETURN_IF_FAILED(result, "xrEnumerateApiLayerProperties()", m_instance); |
106 |
RETURN_IF_FAILED(result, "xrEnumerateApiLayerProperties()", m_instance); |
| 101 |
LOG(XR, "xrEnumerateApiLayerProperties(): %zu properties\n", properties.size()); |
107 |
LOG(XR, "xrEnumerateApiLayerProperties(): %zu properties\n", properties.size()); |
| 102 |
} |
108 |
} |
|
Lines 213-218
OpenXRDevice::OpenXRDevice(XrSystemId id, XrInstance instance)
a/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp_sec3
|
| 213 |
LOG(XR, "xrGetSystemProperties(): error %s\n", resultToString(result, m_instance).utf8().data()); |
219 |
LOG(XR, "xrGetSystemProperties(): error %s\n", resultToString(result, m_instance).utf8().data()); |
| 214 |
|
220 |
|
| 215 |
collectSupportedSessionModes(); |
221 |
collectSupportedSessionModes(); |
|
|
222 |
enumerateConfigurationViews(); |
| 216 |
} |
223 |
} |
| 217 |
|
224 |
|
| 218 |
void OpenXRDevice::collectSupportedSessionModes() |
225 |
void OpenXRDevice::collectSupportedSessionModes() |
|
Lines 232-249
void OpenXRDevice::collectSupportedSessionModes()
a/Source/WebCore/platform/xr/openxr/PlatformXROpenXR.cpp_sec4
|
| 232 |
LOG(XR, "xrGetViewConfigurationProperties(): error %s\n", resultToString(result, m_instance).utf8().data()); |
239 |
LOG(XR, "xrGetViewConfigurationProperties(): error %s\n", resultToString(result, m_instance).utf8().data()); |
| 233 |
continue; |
240 |
continue; |
| 234 |
} |
241 |
} |
| 235 |
switch (viewConfigurationProperties.viewConfigurationType) { |
242 |
auto configType = viewConfigurationProperties.viewConfigurationType; |
|
|
243 |
switch (configType) { |
| 236 |
case XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO: |
244 |
case XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO: |
| 237 |
setEnabledFeatures(SessionMode::ImmersiveAr, { }); |
245 |
setEnabledFeatures(SessionMode::Inline, { }); |
| 238 |
break; |
246 |
break; |
| 239 |
case XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO: |
247 |
case XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO: |
| 240 |
setEnabledFeatures(SessionMode::ImmersiveVr, { }); |
248 |
setEnabledFeatures(SessionMode::ImmersiveVr, { }); |
| 241 |
break; |
249 |
break; |
| 242 |
default: |
250 |
default: |
| 243 |
break; |
251 |
continue; |
| 244 |
}; |
252 |
}; |
|
|
253 |
m_viewConfigurationProperties.add(configType, WTFMove(viewConfigurationProperties)); |
| 254 |
} |
| 255 |
} |
| 256 |
|
| 257 |
void OpenXRDevice::enumerateConfigurationViews() |
| 258 |
{ |
| 259 |
for (auto& config : m_viewConfigurationProperties.values()) { |
| 260 |
uint32_t viewCount; |
| 261 |
auto configType = config.viewConfigurationType; |
| 262 |
auto result = xrEnumerateViewConfigurationViews(m_instance, m_systemId, configType, 0, &viewCount, nullptr); |
| 263 |
if (result != XR_SUCCESS) { |
| 264 |
LOG(XR, "%s %s: %s\n", __func__, "xrEnumerateViewConfigurationViews", resultToString(result, m_instance).utf8().data()); |
| 265 |
continue; |
| 266 |
} |
| 267 |
|
| 268 |
Vector<XrViewConfigurationView> configViews(viewCount, |
| 269 |
[] { |
| 270 |
XrViewConfigurationView object; |
| 271 |
std::memset(&object, 0, sizeof(XrViewConfigurationView)); |
| 272 |
object.type = XR_TYPE_VIEW_CONFIGURATION_VIEW; |
| 273 |
return object; |
| 274 |
}()); |
| 275 |
result = xrEnumerateViewConfigurationViews(m_instance, m_systemId, configType, viewCount, &viewCount, configViews.data()); |
| 276 |
if (result != XR_SUCCESS) |
| 277 |
continue; |
| 278 |
m_configurationViews.add(configType, WTFMove(configViews)); |
| 245 |
} |
279 |
} |
| 246 |
} |
280 |
} |
|
|
281 |
|
| 282 |
WebCore::IntSize OpenXRDevice::recommendedResolution(SessionMode mode) |
| 283 |
{ |
| 284 |
auto configType = mode == SessionMode::Inline ? XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO : XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO; |
| 285 |
auto viewsIterator = m_configurationViews.find(configType); |
| 286 |
if (viewsIterator != m_configurationViews.end()) |
| 287 |
return { static_cast<int>(viewsIterator->value[0].recommendedImageRectWidth), static_cast<int>(viewsIterator->value[0].recommendedImageRectHeight) }; |
| 288 |
return Device::recommendedResolution(mode); |
| 289 |
} |
| 290 |
|
| 291 |
|
| 247 |
#endif // USE_OPENXR |
292 |
#endif // USE_OPENXR |
| 248 |
|
293 |
|
| 249 |
} // namespace PlatformXR |
294 |
} // namespace PlatformXR |