Revert "Updated the OpenXR spec from 1.0.5 to 1.0.11"
This reverts commit f98a2005dd
.
Reason for revert: suspected to be causing various test failures on win7
See https://crbug.com/1138151
Original change's description:
> Updated the OpenXR spec from 1.0.5 to 1.0.11
>
> Updated the OpenXR spec which changes the way extension methods are
> queried. I separated the extension support enumeration and method
> querying.
>
> Updating the spec retains backwards and forward compatibility with
> apps as that is mediated through the loader which is unchanged.
> Extension lookup is now dynamic, and after this change, we can
> implement AR features on OpenXR (e.g. hand tracking, anchors etc.)
>
> Change-Id: I8a4ae718ca244c91b85e02f9441525a9b1416b58
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2406701
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> Reviewed-by: Alexander Cooper <alcooper@chromium.org>
> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> Commit-Queue: Lachlan Ford <laford@microsoft.com>
> Cr-Commit-Position: refs/heads/master@{#816823}
TBR=brucedawson@chromium.org,rafael.cintron@microsoft.com,scottmg@chromium.org,martiniss@chromium.org,patrto@microsoft.com,alcooper@chromium.org,laford@microsoft.com
Bug: 1138151
Change-Id: Idbd194d1197dd82d02cfd016421637b027520586
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472913
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817243}
This commit is contained in:
DEPS
build/config/win
device/vr
BUILD.gn
openxr
openxr_api_wrapper.ccopenxr_api_wrapper.hopenxr_controller.ccopenxr_defs.hopenxr_device.ccopenxr_device.hopenxr_extension_helper.ccopenxr_extension_helper.hopenxr_input_helper.ccopenxr_input_helper.hopenxr_interaction_profiles.hopenxr_render_loop.ccopenxr_render_loop.hopenxr_statics.ccopenxr_statics.hopenxr_util.ccopenxr_util.h
test
third_party/openxr
2
DEPS
2
DEPS
@ -1245,7 +1245,7 @@ deps = {
|
||||
Var('chromium_git') + '/openscreen' + '@' + 'a3f46f23c52688cc3c0de927b7fb8a86ff9e8dff',
|
||||
|
||||
'src/third_party/openxr/src': {
|
||||
'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + 'e3a4e41d61544d8e2eba73f00da99b6818ec472b',
|
||||
'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + '9e97b73e7dd2bfc07745489d728f6a36665c648f',
|
||||
'condition': 'checkout_openxr',
|
||||
},
|
||||
|
||||
|
@ -383,7 +383,6 @@ config("cfi_linker") {
|
||||
# tests with the full browser.
|
||||
config("delayloads") {
|
||||
ldflags = [
|
||||
"/DELAYLOAD:api-ms-win-core-path-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
|
||||
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
|
||||
|
@ -229,10 +229,9 @@ if (enable_vr) {
|
||||
"openxr/openxr_api_wrapper.h",
|
||||
"openxr/openxr_controller.cc",
|
||||
"openxr/openxr_controller.h",
|
||||
"openxr/openxr_defs.h",
|
||||
"openxr/openxr_device.cc",
|
||||
"openxr/openxr_device.h",
|
||||
"openxr/openxr_extension_helper.cc",
|
||||
"openxr/openxr_extension_helper.h",
|
||||
"openxr/openxr_input_helper.cc",
|
||||
"openxr/openxr_input_helper.h",
|
||||
"openxr/openxr_interaction_profiles.h",
|
||||
@ -322,8 +321,7 @@ if (enable_openxr) {
|
||||
include_dirs = [ "//third_party/openxr/src/include" ]
|
||||
|
||||
sources = [
|
||||
"openxr/openxr_extension_helper.cc",
|
||||
"openxr/openxr_extension_helper.h",
|
||||
"openxr/openxr_defs.h",
|
||||
"openxr/openxr_util.cc",
|
||||
"openxr/openxr_util.h",
|
||||
"openxr/test/fake_openxr_impl_api.cc",
|
||||
|
@ -271,8 +271,7 @@ bool OpenXrApiWrapper::UpdateAndGetSessionEnded() {
|
||||
// objects that may have been created before the failure.
|
||||
XrResult OpenXrApiWrapper::InitSession(
|
||||
const Microsoft::WRL::ComPtr<ID3D11Device>& d3d_device,
|
||||
std::unique_ptr<OpenXRInputHelper>* input_helper,
|
||||
const OpenXrExtensionHelper& extension_helper) {
|
||||
std::unique_ptr<OpenXRInputHelper>* input_helper) {
|
||||
DCHECK(d3d_device.Get());
|
||||
DCHECK(IsInitialized());
|
||||
|
||||
@ -287,13 +286,14 @@ XrResult OpenXrApiWrapper::InitSession(
|
||||
CreateSpace(XR_REFERENCE_SPACE_TYPE_STAGE, &stage_space_);
|
||||
UpdateStageBounds();
|
||||
|
||||
if (extension_helper.ExtensionEnumeration()->ExtensionSupported(
|
||||
OpenXrExtensionHelper extension_helper;
|
||||
if (extension_helper.ExtensionSupported(
|
||||
XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME)) {
|
||||
RETURN_IF_XR_FAILED(
|
||||
CreateSpace(XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT, &unbounded_space_));
|
||||
}
|
||||
|
||||
RETURN_IF_XR_FAILED(CreateGamepadHelper(input_helper, extension_helper));
|
||||
RETURN_IF_XR_FAILED(CreateGamepadHelper(input_helper));
|
||||
|
||||
// Since the objects in these arrays are used on every frame,
|
||||
// we don't want to create and destroy these objects every frame,
|
||||
@ -395,13 +395,12 @@ XrResult OpenXrApiWrapper::CreateSpace(XrReferenceSpaceType type,
|
||||
}
|
||||
|
||||
XrResult OpenXrApiWrapper::CreateGamepadHelper(
|
||||
std::unique_ptr<OpenXRInputHelper>* input_helper,
|
||||
const OpenXrExtensionHelper& extension_helper) {
|
||||
std::unique_ptr<OpenXRInputHelper>* input_helper) {
|
||||
DCHECK(HasSession());
|
||||
DCHECK(HasSpace(XR_REFERENCE_SPACE_TYPE_LOCAL));
|
||||
|
||||
return OpenXRInputHelper::CreateOpenXRInputHelper(
|
||||
instance_, extension_helper, session_, local_space_, input_helper);
|
||||
return OpenXRInputHelper::CreateOpenXRInputHelper(instance_, session_,
|
||||
local_space_, input_helper);
|
||||
}
|
||||
|
||||
XrResult OpenXrApiWrapper::BeginSession() {
|
||||
@ -621,20 +620,13 @@ void OpenXrApiWrapper::GetHeadFromEyes(XrView* left, XrView* right) const {
|
||||
*right = head_from_eye_views_[1];
|
||||
}
|
||||
|
||||
XrResult OpenXrApiWrapper::GetLuid(
|
||||
LUID* luid,
|
||||
const OpenXrExtensionHelper& extension_helper) const {
|
||||
XrResult OpenXrApiWrapper::GetLuid(LUID* luid) const {
|
||||
DCHECK(IsInitialized());
|
||||
|
||||
if (extension_helper.ExtensionMethods().xrGetD3D11GraphicsRequirementsKHR ==
|
||||
nullptr)
|
||||
return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
|
||||
XrGraphicsRequirementsD3D11KHR graphics_requirements = {
|
||||
XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR};
|
||||
RETURN_IF_XR_FAILED(
|
||||
extension_helper.ExtensionMethods().xrGetD3D11GraphicsRequirementsKHR(
|
||||
instance_, system_, &graphics_requirements));
|
||||
RETURN_IF_XR_FAILED(xrGetD3D11GraphicsRequirementsKHR(
|
||||
instance_, system_, &graphics_requirements));
|
||||
|
||||
luid->LowPart = graphics_requirements.adapterLuid.LowPart;
|
||||
luid->HighPart = graphics_requirements.adapterLuid.HighPart;
|
||||
|
@ -47,8 +47,7 @@ class OpenXrApiWrapper {
|
||||
bool UpdateAndGetSessionEnded();
|
||||
|
||||
XrResult InitSession(const Microsoft::WRL::ComPtr<ID3D11Device>& d3d_device,
|
||||
std::unique_ptr<OpenXRInputHelper>* input_helper,
|
||||
const OpenXrExtensionHelper& extension_helper);
|
||||
std::unique_ptr<OpenXRInputHelper>* input_helper);
|
||||
|
||||
XrResult BeginFrame(Microsoft::WRL::ComPtr<ID3D11Texture2D>* texture);
|
||||
XrResult EndFrame();
|
||||
@ -61,8 +60,7 @@ class OpenXrApiWrapper {
|
||||
|
||||
gfx::Size GetViewSize() const;
|
||||
XrTime GetPredictedDisplayTime() const;
|
||||
XrResult GetLuid(LUID* luid,
|
||||
const OpenXrExtensionHelper& extension_helper) const;
|
||||
XrResult GetLuid(LUID* luid) const;
|
||||
bool GetStageParameters(XrExtent2Df* stage_bounds,
|
||||
gfx::Transform* local_from_stage);
|
||||
void RegisterInteractionProfileChangeCallback(
|
||||
@ -91,8 +89,8 @@ class OpenXrApiWrapper {
|
||||
const Microsoft::WRL::ComPtr<ID3D11Device>& d3d_device);
|
||||
XrResult CreateSwapchain();
|
||||
XrResult CreateSpace(XrReferenceSpaceType type, XrSpace* space);
|
||||
XrResult CreateGamepadHelper(std::unique_ptr<OpenXRInputHelper>* input_helper,
|
||||
const OpenXrExtensionHelper& extension_helper);
|
||||
XrResult CreateGamepadHelper(
|
||||
std::unique_ptr<OpenXRInputHelper>* input_helper);
|
||||
|
||||
XrResult BeginSession();
|
||||
XrResult UpdateProjectionLayers();
|
||||
|
@ -143,9 +143,8 @@ XrResult OpenXrController::SuggestBindings(
|
||||
const bool extension_required =
|
||||
interaction_profile.required_extension != nullptr;
|
||||
if (extension_required) {
|
||||
const bool extension_enabled =
|
||||
extension_helper.ExtensionEnumeration()->ExtensionSupported(
|
||||
interaction_profile.required_extension);
|
||||
const bool extension_enabled = extension_helper.ExtensionSupported(
|
||||
interaction_profile.required_extension);
|
||||
if (!extension_enabled) {
|
||||
continue;
|
||||
}
|
||||
|
19
device/vr/openxr/openxr_defs.h
Normal file
19
device/vr/openxr/openxr_defs.h
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef DEVICE_VR_OPENXR_OPENXR_DEFS_H_
|
||||
#define DEVICE_VR_OPENXR_OPENXR_DEFS_H_
|
||||
|
||||
namespace device {
|
||||
constexpr char kWin32AppcontainerCompatibleExtensionName[] =
|
||||
"XR_EXT_win32_appcontainer_compatible";
|
||||
|
||||
constexpr char kExtSamsungOdysseyControllerExtensionName[] =
|
||||
"XR_EXT_samsung_odyssey_controller";
|
||||
constexpr char kExtHPMixedRealityControllerExtensionName[] =
|
||||
"XR_EXT_hp_mixed_reality_controller";
|
||||
|
||||
} // namespace device
|
||||
|
||||
#endif // DEVICE_VR_OPENXR_OPENXR_DEFS_H_
|
@ -58,13 +58,12 @@ mojom::VRDisplayInfoPtr CreateFakeVRDisplayInfo() {
|
||||
OpenXrDevice::OpenXrDevice(OpenXrStatics* openxr_statics)
|
||||
: VRDeviceBase(device::mojom::XRDeviceId::OPENXR_DEVICE_ID),
|
||||
instance_(openxr_statics->GetXrInstance()),
|
||||
extension_helper_(instance_, openxr_statics->GetExtensionEnumeration()),
|
||||
weak_ptr_factory_(this) {
|
||||
mojom::VRDisplayInfoPtr display_info = CreateFakeVRDisplayInfo();
|
||||
SetVRDisplayInfo(std::move(display_info));
|
||||
SetArBlendModeSupported(IsArBlendModeSupported(openxr_statics));
|
||||
#if defined(OS_WIN)
|
||||
SetLuid(openxr_statics->GetLuid(extension_helper_));
|
||||
SetLuid(openxr_statics->GetLuid());
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -87,7 +86,7 @@ void OpenXrDevice::EnsureRenderLoop() {
|
||||
auto on_info_changed = base::BindRepeating(&OpenXrDevice::SetVRDisplayInfo,
|
||||
weak_ptr_factory_.GetWeakPtr());
|
||||
render_loop_ = std::make_unique<OpenXrRenderLoop>(
|
||||
std::move(on_info_changed), instance_, extension_helper_);
|
||||
std::move(on_info_changed), instance_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "device/vr/openxr/openxr_util.h"
|
||||
#include "device/vr/public/mojom/vr_service.mojom.h"
|
||||
#include "device/vr/vr_device_base.h"
|
||||
#include "device/vr/vr_export.h"
|
||||
@ -54,7 +53,6 @@ class DEVICE_VR_EXPORT OpenXrDevice
|
||||
bool IsArBlendModeSupported(OpenXrStatics* openxr_statics);
|
||||
|
||||
XrInstance instance_;
|
||||
OpenXrExtensionHelper extension_helper_;
|
||||
std::unique_ptr<OpenXrRenderLoop> render_loop_;
|
||||
|
||||
mojo::Receiver<mojom::XRSessionController> exclusive_controller_receiver_{
|
||||
|
@ -1,46 +0,0 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "device/vr/openxr/openxr_extension_helper.h"
|
||||
|
||||
namespace device {
|
||||
|
||||
OpenXrExtensionEnumeration::OpenXrExtensionEnumeration() {
|
||||
uint32_t extension_count;
|
||||
if (XR_SUCCEEDED(xrEnumerateInstanceExtensionProperties(
|
||||
nullptr, 0, &extension_count, nullptr))) {
|
||||
extension_properties_.resize(extension_count,
|
||||
{XR_TYPE_EXTENSION_PROPERTIES});
|
||||
xrEnumerateInstanceExtensionProperties(nullptr, extension_count,
|
||||
&extension_count,
|
||||
extension_properties_.data());
|
||||
}
|
||||
}
|
||||
|
||||
OpenXrExtensionEnumeration::~OpenXrExtensionEnumeration() = default;
|
||||
|
||||
bool OpenXrExtensionEnumeration::ExtensionSupported(
|
||||
const char* extension_name) const {
|
||||
return std::find_if(
|
||||
extension_properties_.begin(), extension_properties_.end(),
|
||||
[&extension_name](const XrExtensionProperties& properties) {
|
||||
return strcmp(properties.extensionName, extension_name) == 0;
|
||||
}) != extension_properties_.end();
|
||||
}
|
||||
|
||||
OpenXrExtensionHelper::~OpenXrExtensionHelper() = default;
|
||||
|
||||
OpenXrExtensionHelper::OpenXrExtensionHelper(
|
||||
XrInstance instance,
|
||||
const OpenXrExtensionEnumeration* const extension_enumeration)
|
||||
: extension_enumeration_(extension_enumeration) {
|
||||
// Failure results in a nullptr
|
||||
(void)xrGetInstanceProcAddr(
|
||||
instance, "xrGetD3D11GraphicsRequirementsKHR",
|
||||
reinterpret_cast<PFN_xrVoidFunction*>(
|
||||
const_cast<PFN_xrGetD3D11GraphicsRequirementsKHR*>(
|
||||
&extension_methods_.xrGetD3D11GraphicsRequirementsKHR)));
|
||||
}
|
||||
|
||||
} // namespace device
|
@ -1,54 +0,0 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef DEVICE_VR_OPENXR_OPENXR_EXTENSION_HELPER_H_
|
||||
#define DEVICE_VR_OPENXR_OPENXR_EXTENSION_HELPER_H_
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr_platform.h"
|
||||
|
||||
namespace device {
|
||||
struct OpenXrExtensionMethods {
|
||||
PFN_xrGetD3D11GraphicsRequirementsKHR xrGetD3D11GraphicsRequirementsKHR{
|
||||
nullptr};
|
||||
};
|
||||
|
||||
class OpenXrExtensionEnumeration {
|
||||
public:
|
||||
OpenXrExtensionEnumeration();
|
||||
~OpenXrExtensionEnumeration();
|
||||
|
||||
bool ExtensionSupported(const char* extension_name) const;
|
||||
|
||||
private:
|
||||
std::vector<XrExtensionProperties> extension_properties_;
|
||||
};
|
||||
|
||||
class OpenXrExtensionHelper {
|
||||
public:
|
||||
OpenXrExtensionHelper(
|
||||
XrInstance instance,
|
||||
const OpenXrExtensionEnumeration* const extension_enumeration);
|
||||
~OpenXrExtensionHelper();
|
||||
|
||||
const OpenXrExtensionEnumeration* ExtensionEnumeration() const {
|
||||
return extension_enumeration_;
|
||||
}
|
||||
|
||||
const OpenXrExtensionMethods& ExtensionMethods() const {
|
||||
return extension_methods_;
|
||||
}
|
||||
|
||||
private:
|
||||
const OpenXrExtensionMethods extension_methods_;
|
||||
const OpenXrExtensionEnumeration* const extension_enumeration_;
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
|
||||
#endif // DEVICE_VR_OPENXR_OPENXR_EXTENSION_HELPER_H_
|
@ -96,14 +96,13 @@ base::Optional<Gamepad> GetXrStandardGamepad(
|
||||
|
||||
XrResult OpenXRInputHelper::CreateOpenXRInputHelper(
|
||||
XrInstance instance,
|
||||
const OpenXrExtensionHelper& extension_helper,
|
||||
XrSession session,
|
||||
XrSpace local_space,
|
||||
std::unique_ptr<OpenXRInputHelper>* helper) {
|
||||
std::unique_ptr<OpenXRInputHelper> new_helper =
|
||||
std::make_unique<OpenXRInputHelper>(session, local_space);
|
||||
|
||||
RETURN_IF_XR_FAILED(new_helper->Initialize(instance, extension_helper));
|
||||
RETURN_IF_XR_FAILED(new_helper->Initialize(instance));
|
||||
*helper = std::move(new_helper);
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
@ -115,9 +114,7 @@ OpenXRInputHelper::OpenXRInputHelper(XrSession session, XrSpace local_space)
|
||||
|
||||
OpenXRInputHelper::~OpenXRInputHelper() = default;
|
||||
|
||||
XrResult OpenXRInputHelper::Initialize(
|
||||
XrInstance instance,
|
||||
const OpenXrExtensionHelper& extension_helper) {
|
||||
XrResult OpenXRInputHelper::Initialize(XrInstance instance) {
|
||||
RETURN_IF_XR_FAILED(path_helper_->Initialize(instance));
|
||||
|
||||
// This map is used to store bindings for different kinds of interaction
|
||||
@ -125,6 +122,7 @@ XrResult OpenXRInputHelper::Initialize(
|
||||
// on availability.
|
||||
std::map<XrPath, std::vector<XrActionSuggestedBinding>> bindings;
|
||||
|
||||
OpenXrExtensionHelper extension_helper;
|
||||
for (size_t i = 0; i < controller_states_.size(); i++) {
|
||||
RETURN_IF_XR_FAILED(controller_states_[i].controller.Initialize(
|
||||
static_cast<OpenXrHandednessType>(i), instance, session_,
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "device/vr/openxr/openxr_controller.h"
|
||||
#include "device/vr/openxr/openxr_interaction_profiles.h"
|
||||
#include "device/vr/openxr/openxr_util.h"
|
||||
|
||||
namespace device {
|
||||
|
||||
@ -21,7 +20,6 @@ class OpenXRInputHelper {
|
||||
public:
|
||||
static XrResult CreateOpenXRInputHelper(
|
||||
XrInstance instance,
|
||||
const OpenXrExtensionHelper& extension_helper,
|
||||
XrSession session,
|
||||
XrSpace local_space,
|
||||
std::unique_ptr<OpenXRInputHelper>* helper);
|
||||
@ -40,8 +38,7 @@ class OpenXRInputHelper {
|
||||
private:
|
||||
base::Optional<Gamepad> GetWebXRGamepad(const OpenXrController& controller);
|
||||
|
||||
XrResult Initialize(XrInstance instance,
|
||||
const OpenXrExtensionHelper& extension_helper);
|
||||
XrResult Initialize(XrInstance instance);
|
||||
|
||||
XrResult SyncActions(XrTime predicted_display_time);
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "base/stl_util.h"
|
||||
#include "device/gamepad/public/cpp/gamepad.h"
|
||||
#include "device/vr/openxr/openxr_defs.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr.h"
|
||||
|
||||
namespace device {
|
||||
@ -380,7 +381,7 @@ constexpr OpenXrControllerInteractionProfile kHTCViveInteractionProfile = {
|
||||
constexpr OpenXrControllerInteractionProfile kSamsungOdysseyInteractionProfile =
|
||||
{OpenXrInteractionProfileType::kSamsungOdyssey,
|
||||
"/interaction_profiles/samsung/odyssey_controller",
|
||||
XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME,
|
||||
kExtSamsungOdysseyControllerExtensionName,
|
||||
GamepadMapping::kXrStandard,
|
||||
kSamsungOdysseyInputProfiles,
|
||||
base::size(kSamsungOdysseyInputProfiles),
|
||||
@ -394,7 +395,7 @@ constexpr OpenXrControllerInteractionProfile kSamsungOdysseyInteractionProfile =
|
||||
constexpr OpenXrControllerInteractionProfile kHPReverbG2InteractionProfile = {
|
||||
OpenXrInteractionProfileType::kHPReverbG2,
|
||||
"/interaction_profiles/hp/mixed_reality_controller",
|
||||
XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME,
|
||||
kExtHPMixedRealityControllerExtensionName,
|
||||
GamepadMapping::kXrStandard,
|
||||
kHPReverbG2InputProfiles,
|
||||
base::size(kHPReverbG2InputProfiles),
|
||||
|
@ -17,11 +17,9 @@ namespace device {
|
||||
OpenXrRenderLoop::OpenXrRenderLoop(
|
||||
base::RepeatingCallback<void(mojom::VRDisplayInfoPtr)>
|
||||
on_display_info_changed,
|
||||
XrInstance instance,
|
||||
const OpenXrExtensionHelper& extension_helper)
|
||||
XrInstance instance)
|
||||
: XRCompositorCommon(),
|
||||
instance_(instance),
|
||||
extension_helper_(extension_helper),
|
||||
on_display_info_changed_(std::move(on_display_info_changed)) {
|
||||
DCHECK(instance_ != XR_NULL_HANDLE);
|
||||
}
|
||||
@ -93,11 +91,11 @@ bool OpenXrRenderLoop::StartRuntime() {
|
||||
|
||||
texture_helper_.SetUseBGRA(true);
|
||||
LUID luid;
|
||||
if (XR_FAILED(openxr->GetLuid(&luid, extension_helper_)) ||
|
||||
if (XR_FAILED(openxr->GetLuid(&luid)) ||
|
||||
!texture_helper_.SetAdapterLUID(luid) ||
|
||||
!texture_helper_.EnsureInitialized() ||
|
||||
XR_FAILED(openxr->InitSession(texture_helper_.GetDevice(), &input_helper_,
|
||||
extension_helper_))) {
|
||||
XR_FAILED(
|
||||
openxr->InitSession(texture_helper_.GetDevice(), &input_helper_))) {
|
||||
texture_helper_.Reset();
|
||||
return false;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/macros.h"
|
||||
#include "device/vr/openxr/openxr_util.h"
|
||||
#include "device/vr/windows/compositor_base.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr.h"
|
||||
|
||||
@ -25,8 +24,7 @@ class OpenXrRenderLoop : public XRCompositorCommon {
|
||||
public:
|
||||
OpenXrRenderLoop(base::RepeatingCallback<void(mojom::VRDisplayInfoPtr)>
|
||||
on_display_info_changed,
|
||||
XrInstance instance,
|
||||
const OpenXrExtensionHelper& extension_helper_);
|
||||
XrInstance instance);
|
||||
~OpenXrRenderLoop() override;
|
||||
|
||||
private:
|
||||
@ -55,7 +53,6 @@ class OpenXrRenderLoop : public XRCompositorCommon {
|
||||
|
||||
// Owned by OpenXrStatics
|
||||
XrInstance instance_;
|
||||
const OpenXrExtensionHelper& extension_helper_;
|
||||
|
||||
std::unique_ptr<OpenXrApiWrapper> openxr_;
|
||||
std::unique_ptr<OpenXRInputHelper> input_helper_;
|
||||
|
@ -17,8 +17,7 @@ OpenXrStatics::~OpenXrStatics() {
|
||||
}
|
||||
|
||||
XrInstance OpenXrStatics::GetXrInstance() {
|
||||
if (instance_ == XR_NULL_HANDLE &&
|
||||
XR_FAILED(CreateInstance(&instance_, extension_enumeration_))) {
|
||||
if (instance_ == XR_NULL_HANDLE && XR_FAILED(CreateInstance(&instance_))) {
|
||||
return XR_NULL_HANDLE;
|
||||
}
|
||||
return instance_;
|
||||
@ -40,7 +39,7 @@ bool OpenXrStatics::IsApiAvailable() {
|
||||
#if defined(OS_WIN)
|
||||
// Returns the LUID of the adapter the OpenXR runtime is on. Returns {0, 0} if
|
||||
// the LUID could not be determined.
|
||||
LUID OpenXrStatics::GetLuid(const OpenXrExtensionHelper& extension_helper) {
|
||||
LUID OpenXrStatics::GetLuid() {
|
||||
if (GetXrInstance() == XR_NULL_HANDLE)
|
||||
return {0, 0};
|
||||
|
||||
@ -48,15 +47,10 @@ LUID OpenXrStatics::GetLuid(const OpenXrExtensionHelper& extension_helper) {
|
||||
if (XR_FAILED(GetSystem(instance_, &system)))
|
||||
return {0, 0};
|
||||
|
||||
if (extension_helper.ExtensionMethods().xrGetD3D11GraphicsRequirementsKHR ==
|
||||
nullptr)
|
||||
return {0, 0};
|
||||
|
||||
XrGraphicsRequirementsD3D11KHR graphics_requirements = {
|
||||
XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR};
|
||||
if (XR_FAILED(
|
||||
extension_helper.ExtensionMethods().xrGetD3D11GraphicsRequirementsKHR(
|
||||
instance_, system, &graphics_requirements)))
|
||||
if (XR_FAILED(xrGetD3D11GraphicsRequirementsKHR(instance_, system,
|
||||
&graphics_requirements)))
|
||||
return {0, 0};
|
||||
|
||||
return graphics_requirements.adapterLuid;
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "device/vr/openxr/openxr_util.h"
|
||||
#include "device/vr/vr_export.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr_platform.h"
|
||||
@ -23,22 +22,17 @@ class DEVICE_VR_EXPORT OpenXrStatics {
|
||||
OpenXrStatics();
|
||||
~OpenXrStatics();
|
||||
|
||||
const OpenXrExtensionEnumeration* GetExtensionEnumeration() const {
|
||||
return &extension_enumeration_;
|
||||
}
|
||||
|
||||
XrInstance GetXrInstance();
|
||||
|
||||
bool IsHardwareAvailable();
|
||||
bool IsApiAvailable();
|
||||
|
||||
#if defined(OS_WIN)
|
||||
LUID GetLuid(const OpenXrExtensionHelper& extension_helper);
|
||||
LUID GetLuid();
|
||||
#endif
|
||||
|
||||
private:
|
||||
XrInstance instance_;
|
||||
OpenXrExtensionEnumeration extension_enumeration_;
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
|
@ -3,8 +3,11 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "device/vr/openxr/openxr_util.h"
|
||||
#include "device/vr/openxr/openxr_defs.h"
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/stl_util.h"
|
||||
@ -12,6 +15,7 @@
|
||||
#include "base/win/scoped_handle.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr_platform.h"
|
||||
|
||||
namespace device {
|
||||
|
||||
@ -52,9 +56,30 @@ bool IsRunningInWin32AppContainer() {
|
||||
}
|
||||
#endif
|
||||
|
||||
XrResult CreateInstance(
|
||||
XrInstance* instance,
|
||||
const OpenXrExtensionEnumeration& extension_enumeration) {
|
||||
OpenXrExtensionHelper::OpenXrExtensionHelper() {
|
||||
uint32_t extension_count;
|
||||
if (XR_SUCCEEDED(xrEnumerateInstanceExtensionProperties(
|
||||
nullptr, 0, &extension_count, nullptr))) {
|
||||
extension_properties_.resize(extension_count,
|
||||
{XR_TYPE_EXTENSION_PROPERTIES});
|
||||
xrEnumerateInstanceExtensionProperties(nullptr, extension_count,
|
||||
&extension_count,
|
||||
extension_properties_.data());
|
||||
}
|
||||
}
|
||||
|
||||
OpenXrExtensionHelper::~OpenXrExtensionHelper() = default;
|
||||
|
||||
bool OpenXrExtensionHelper::ExtensionSupported(
|
||||
const char* extension_name) const {
|
||||
return std::find_if(
|
||||
extension_properties_.begin(), extension_properties_.end(),
|
||||
[&extension_name](const XrExtensionProperties& properties) {
|
||||
return strcmp(properties.extensionName, extension_name) == 0;
|
||||
}) != extension_properties_.end();
|
||||
}
|
||||
|
||||
XrResult CreateInstance(XrInstance* instance) {
|
||||
XrInstanceCreateInfo instance_create_info = {XR_TYPE_INSTANCE_CREATE_INFO};
|
||||
|
||||
std::string application_name = version_info::GetProductName() + " " +
|
||||
@ -96,14 +121,15 @@ XrResult CreateInstance(
|
||||
// Add the win32 app container compatible extension to our list of
|
||||
// extensions. If this runtime does not support execution in an app
|
||||
// container environment, one of xrCreateInstance or xrGetSystem will fail.
|
||||
extensions.push_back(XR_EXT_WIN32_APPCONTAINER_COMPATIBLE_EXTENSION_NAME);
|
||||
extensions.push_back(kWin32AppcontainerCompatibleExtensionName);
|
||||
}
|
||||
|
||||
// XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME, is required for optional
|
||||
// functionality (unbounded reference spaces) and thus only requested if it is
|
||||
// available.
|
||||
OpenXrExtensionHelper extension_helper;
|
||||
const bool unboundedSpaceExtensionSupported =
|
||||
extension_enumeration.ExtensionSupported(
|
||||
extension_helper.ExtensionSupported(
|
||||
XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME);
|
||||
if (unboundedSpaceExtensionSupported) {
|
||||
extensions.push_back(XR_MSFT_UNBOUNDED_REFERENCE_SPACE_EXTENSION_NAME);
|
||||
@ -112,17 +138,17 @@ XrResult CreateInstance(
|
||||
// Input extensions. These enable interaction profiles not defined in the core
|
||||
// spec
|
||||
const bool samsungInteractionProfileExtensionSupported =
|
||||
extension_enumeration.ExtensionSupported(
|
||||
XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME);
|
||||
extension_helper.ExtensionSupported(
|
||||
kExtSamsungOdysseyControllerExtensionName);
|
||||
if (samsungInteractionProfileExtensionSupported) {
|
||||
extensions.push_back(XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME);
|
||||
extensions.push_back(kExtSamsungOdysseyControllerExtensionName);
|
||||
}
|
||||
|
||||
const bool hpControllerExtensionSupported =
|
||||
extension_enumeration.ExtensionSupported(
|
||||
XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
|
||||
extension_helper.ExtensionSupported(
|
||||
kExtHPMixedRealityControllerExtensionName);
|
||||
if (hpControllerExtensionSupported) {
|
||||
extensions.push_back(XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
|
||||
extensions.push_back(kExtHPMixedRealityControllerExtensionName);
|
||||
}
|
||||
|
||||
const bool handInteractionExtensionSupported =
|
||||
|
@ -5,15 +5,23 @@
|
||||
#ifndef DEVICE_VR_OPENXR_OPENXR_UTIL_H_
|
||||
#define DEVICE_VR_OPENXR_OPENXR_UTIL_H_
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <vector>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "device/vr/openxr/openxr_extension_helper.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr_platform.h"
|
||||
|
||||
namespace device {
|
||||
class OpenXrExtensionHelper {
|
||||
public:
|
||||
OpenXrExtensionHelper();
|
||||
~OpenXrExtensionHelper();
|
||||
|
||||
bool ExtensionSupported(const char* extension_name) const;
|
||||
|
||||
private:
|
||||
std::vector<XrExtensionProperties> extension_properties_;
|
||||
};
|
||||
|
||||
// These macros aren't common in Chromium and generally discouraged, so define
|
||||
// all OpenXR helper macros here so they can be kept track of. This file
|
||||
// should not be included outside of device/vr/openxr.
|
||||
@ -50,9 +58,7 @@ XrPosef PoseIdentity();
|
||||
|
||||
XrResult GetSystem(XrInstance instance, XrSystemId* system);
|
||||
|
||||
XrResult CreateInstance(
|
||||
XrInstance* instance,
|
||||
const OpenXrExtensionEnumeration& extension_enumeration);
|
||||
XrResult CreateInstance(XrInstance* instance);
|
||||
|
||||
std::vector<XrEnvironmentBlendMode> GetSupportedBlendModes(XrInstance instance,
|
||||
XrSystemId system);
|
||||
|
@ -16,8 +16,6 @@ namespace {
|
||||
OpenXrTestHelper g_test_helper;
|
||||
} // namespace
|
||||
|
||||
// Extension methods
|
||||
|
||||
// Mock implementations of openxr runtime.dll APIs.
|
||||
// Please add new APIs in alphabetical order.
|
||||
|
||||
@ -905,100 +903,3 @@ XrResult xrWaitSwapchainImage(XrSwapchain swapchain,
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
// Getter for extension methods. Casts the correct function dynamically based on
|
||||
// the method name provided.
|
||||
// Please add new OpenXR APIs below in alphabetical order.
|
||||
XrResult XRAPI_PTR xrGetInstanceProcAddr(XrInstance instance,
|
||||
const char* name,
|
||||
PFN_xrVoidFunction* function) {
|
||||
if (strcmp(name, "xrAcquireSwapchainImage") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrAcquireSwapchainImage);
|
||||
} else if (strcmp(name, "xrAttachSessionActionSets") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrAttachSessionActionSets);
|
||||
} else if (strcmp(name, "xrBeginFrame") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrBeginFrame);
|
||||
} else if (strcmp(name, "xrBeginSession") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrBeginSession);
|
||||
} else if (strcmp(name, "xrCreateAction") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateAction);
|
||||
} else if (strcmp(name, "xrCreateActionSet") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateActionSet);
|
||||
} else if (strcmp(name, "xrCreateActionSpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateActionSpace);
|
||||
} else if (strcmp(name, "xrCreateInstance") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateInstance);
|
||||
} else if (strcmp(name, "xrCreateReferenceSpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateReferenceSpace);
|
||||
} else if (strcmp(name, "xrCreateSession") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateSession);
|
||||
} else if (strcmp(name, "xrCreateSwapchain") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateSwapchain);
|
||||
} else if (strcmp(name, "xrDestroyActionSet") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrDestroyActionSet);
|
||||
} else if (strcmp(name, "xrDestroyInstance") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrDestroyInstance);
|
||||
} else if (strcmp(name, "xrDestroySpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrDestroySpace);
|
||||
} else if (strcmp(name, "xrEndFrame") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrEndFrame);
|
||||
} else if (strcmp(name, "xrEndSession") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrEndSession);
|
||||
} else if (strcmp(name, "xrEnumerateEnvironmentBlendModes") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrEnumerateEnvironmentBlendModes);
|
||||
} else if (strcmp(name, "xrEnumerateInstanceExtensionProperties") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(
|
||||
xrEnumerateInstanceExtensionProperties);
|
||||
} else if (strcmp(name, "xrEnumerateSwapchainImages") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrEnumerateSwapchainImages);
|
||||
} else if (strcmp(name, "xrEnumerateViewConfigurationViews") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrEnumerateViewConfigurationViews);
|
||||
} else if (strcmp(name, "xrGetD3D11GraphicsRequirementsKHR") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrGetD3D11GraphicsRequirementsKHR);
|
||||
} else if (strcmp(name, "xrGetActionStateFloat") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStateFloat);
|
||||
} else if (strcmp(name, "xrGetActionStateBoolean") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStateBoolean);
|
||||
} else if (strcmp(name, "xrGetActionStateVector2f") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStateVector2f);
|
||||
} else if (strcmp(name, "xrGetActionStatePose") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStatePose);
|
||||
} else if (strcmp(name, "xrGetCurrentInteractionProfile") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrGetCurrentInteractionProfile);
|
||||
} else if (strcmp(name, "xrGetReferenceSpaceBoundsRect") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrGetReferenceSpaceBoundsRect);
|
||||
} else if (strcmp(name, "xrGetSystem") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetSystem);
|
||||
} else if (strcmp(name, "xrLocateSpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrLocateSpace);
|
||||
} else if (strcmp(name, "xrLocateViews") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrLocateViews);
|
||||
} else if (strcmp(name, "xrPollEvent") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrPollEvent);
|
||||
} else if (strcmp(name, "xrReleaseSwapchainImage") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrReleaseSwapchainImage);
|
||||
} else if (strcmp(name, "xrSuggestInteractionProfileBindings") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(
|
||||
xrSuggestInteractionProfileBindings);
|
||||
} else if (strcmp(name, "xrStringToPath") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrStringToPath);
|
||||
} else if (strcmp(name, "xrPathToString") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrPathToString);
|
||||
} else if (strcmp(name, "xrSyncActions") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrSyncActions);
|
||||
} else if (strcmp(name, "xrWaitFrame") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrWaitFrame);
|
||||
} else if (strcmp(name, "xrWaitSwapchainImage") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrWaitSwapchainImage);
|
||||
} else {
|
||||
return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
@ -17,19 +17,110 @@
|
||||
// only be used to call the fake OpenXR APIs defined in
|
||||
// fake_openxr_impl_api.cc.
|
||||
|
||||
XrResult XRAPI_PTR xrGetInstanceProcAddr(XrInstance instance,
|
||||
const char* name,
|
||||
PFN_xrVoidFunction* function);
|
||||
// Please add new OpenXR APIs below in alphabetical order.
|
||||
XrResult XRAPI_PTR GetInstanceProcAddress(XrInstance instance,
|
||||
const char* name,
|
||||
PFN_xrVoidFunction* function) {
|
||||
if (strcmp(name, "xrAcquireSwapchainImage") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrAcquireSwapchainImage);
|
||||
} else if (strcmp(name, "xrAttachSessionActionSets") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrAttachSessionActionSets);
|
||||
} else if (strcmp(name, "xrBeginFrame") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrBeginFrame);
|
||||
} else if (strcmp(name, "xrBeginSession") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrBeginSession);
|
||||
} else if (strcmp(name, "xrCreateAction") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateAction);
|
||||
} else if (strcmp(name, "xrCreateActionSet") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateActionSet);
|
||||
} else if (strcmp(name, "xrCreateActionSpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateActionSpace);
|
||||
} else if (strcmp(name, "xrCreateInstance") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateInstance);
|
||||
} else if (strcmp(name, "xrCreateReferenceSpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateReferenceSpace);
|
||||
} else if (strcmp(name, "xrCreateSession") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateSession);
|
||||
} else if (strcmp(name, "xrCreateSwapchain") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrCreateSwapchain);
|
||||
} else if (strcmp(name, "xrDestroyActionSet") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrDestroyActionSet);
|
||||
} else if (strcmp(name, "xrDestroyInstance") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrDestroyInstance);
|
||||
} else if (strcmp(name, "xrDestroySpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrDestroySpace);
|
||||
} else if (strcmp(name, "xrEndFrame") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrEndFrame);
|
||||
} else if (strcmp(name, "xrEndSession") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrEndSession);
|
||||
} else if (strcmp(name, "xrEnumerateEnvironmentBlendModes") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrEnumerateEnvironmentBlendModes);
|
||||
} else if (strcmp(name, "xrEnumerateInstanceExtensionProperties") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(
|
||||
xrEnumerateInstanceExtensionProperties);
|
||||
} else if (strcmp(name, "xrEnumerateSwapchainImages") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrEnumerateSwapchainImages);
|
||||
} else if (strcmp(name, "xrEnumerateViewConfigurationViews") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrEnumerateViewConfigurationViews);
|
||||
} else if (strcmp(name, "xrGetD3D11GraphicsRequirementsKHR") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrGetD3D11GraphicsRequirementsKHR);
|
||||
} else if (strcmp(name, "xrGetActionStateFloat") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStateFloat);
|
||||
} else if (strcmp(name, "xrGetActionStateBoolean") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStateBoolean);
|
||||
} else if (strcmp(name, "xrGetActionStateVector2f") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStateVector2f);
|
||||
} else if (strcmp(name, "xrGetActionStatePose") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetActionStatePose);
|
||||
} else if (strcmp(name, "xrGetCurrentInteractionProfile") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrGetCurrentInteractionProfile);
|
||||
} else if (strcmp(name, "xrGetReferenceSpaceBoundsRect") == 0) {
|
||||
*function =
|
||||
reinterpret_cast<PFN_xrVoidFunction>(xrGetReferenceSpaceBoundsRect);
|
||||
} else if (strcmp(name, "xrGetSystem") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrGetSystem);
|
||||
} else if (strcmp(name, "xrLocateSpace") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrLocateSpace);
|
||||
} else if (strcmp(name, "xrLocateViews") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrLocateViews);
|
||||
} else if (strcmp(name, "xrPollEvent") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrPollEvent);
|
||||
} else if (strcmp(name, "xrReleaseSwapchainImage") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrReleaseSwapchainImage);
|
||||
} else if (strcmp(name, "xrSuggestInteractionProfileBindings") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(
|
||||
xrSuggestInteractionProfileBindings);
|
||||
} else if (strcmp(name, "xrStringToPath") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrStringToPath);
|
||||
} else if (strcmp(name, "xrPathToString") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrPathToString);
|
||||
} else if (strcmp(name, "xrSyncActions") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrSyncActions);
|
||||
} else if (strcmp(name, "xrWaitFrame") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrWaitFrame);
|
||||
} else if (strcmp(name, "xrWaitSwapchainImage") == 0) {
|
||||
*function = reinterpret_cast<PFN_xrVoidFunction>(xrWaitSwapchainImage);
|
||||
} else {
|
||||
return XR_ERROR_FUNCTION_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
// The single exported function in fake OpenXR Runtime DLL which the OpenXR
|
||||
// loader calls for negotiation. xrGetInstanceProcAddr is returned to the
|
||||
// loader calls for negotiation. GetInstanceProcAddress is returned to the
|
||||
// loader, which is then used by the loader to call OpenXR APIs.
|
||||
XrResult __stdcall xrNegotiateLoaderRuntimeInterface(
|
||||
const XrNegotiateLoaderInfo* loaderInfo,
|
||||
XrNegotiateRuntimeRequest* runtimeRequest) {
|
||||
runtimeRequest->runtimeInterfaceVersion = 1;
|
||||
runtimeRequest->runtimeApiVersion = XR_CURRENT_API_VERSION;
|
||||
runtimeRequest->getInstanceProcAddr = xrGetInstanceProcAddr;
|
||||
runtimeRequest->runtimeApiVersion = XR_MAKE_VERSION(1, 0, 1);
|
||||
runtimeRequest->getInstanceProcAddr = GetInstanceProcAddress;
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "base/optional.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "device/vr/openxr/openxr_defs.h"
|
||||
#include "device/vr/test/test_hook.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr.h"
|
||||
#include "third_party/openxr/src/include/openxr/openxr_platform.h"
|
||||
@ -129,7 +130,7 @@ class OpenXrTestHelper : public device::ServiceTestHook {
|
||||
// Properties of the mock OpenXR runtime that do not change are created
|
||||
static constexpr const char* const kExtensions[] = {
|
||||
XR_KHR_D3D11_ENABLE_EXTENSION_NAME,
|
||||
XR_EXT_WIN32_APPCONTAINER_COMPATIBLE_EXTENSION_NAME};
|
||||
device::kWin32AppcontainerCompatibleExtensionName};
|
||||
static constexpr uint32_t kDimension = 128;
|
||||
static constexpr uint32_t kSwapCount = 1;
|
||||
static constexpr uint32_t kMinSwapchainBuffering = 3;
|
||||
|
6
third_party/openxr/BUILD.gn
vendored
6
third_party/openxr/BUILD.gn
vendored
@ -24,6 +24,7 @@ if (enable_openxr) {
|
||||
"src/src/common/extra_algorithms.h",
|
||||
"src/src/common/filesystem_utils.cpp",
|
||||
"src/src/common/filesystem_utils.hpp",
|
||||
"src/src/common/hex_and_handles.cpp",
|
||||
"src/src/common/hex_and_handles.h",
|
||||
"src/src/common/loader_interfaces.h",
|
||||
"src/src/common/object_info.cpp",
|
||||
@ -58,10 +59,6 @@ if (enable_openxr) {
|
||||
"src/src",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
libs = [ "Pathcch.lib" ]
|
||||
}
|
||||
|
||||
deps = [ "//third_party/jsoncpp" ]
|
||||
|
||||
public_configs = [ ":config" ]
|
||||
@ -76,7 +73,6 @@ if (enable_openxr) {
|
||||
"-Wno-microsoft-cast",
|
||||
"-Wno-microsoft-include",
|
||||
"-Wno-unused-function",
|
||||
"-Wno-extra-semi",
|
||||
]
|
||||
}
|
||||
|
||||
|
4
third_party/openxr/README.chromium
vendored
4
third_party/openxr/README.chromium
vendored
@ -1,8 +1,8 @@
|
||||
Name: OpenXR SDK
|
||||
Short Name: OpenXR
|
||||
URL: https://github.com/KhronosGroup/OpenXR-SDK
|
||||
Version: 1.0.11sd
|
||||
Revision: e3a4e41d61544d8e2eba73f00da99b6818ec472b
|
||||
Version: 1.0.5sd
|
||||
Revision: 9e97b73e7dd2bfc07745489d728f6a36665c648f
|
||||
License: Apache 2.0
|
||||
License File: src/LICENSE
|
||||
Security Critical: yes
|
||||
|
Reference in New Issue
Block a user