diff options
Diffstat (limited to 'thirdparty/openxr/src/common')
-rw-r--r-- | thirdparty/openxr/src/common/unique_asset.h | 33 | ||||
-rw-r--r-- | thirdparty/openxr/src/common/xr_linear.h | 6 |
2 files changed, 36 insertions, 3 deletions
diff --git a/thirdparty/openxr/src/common/unique_asset.h b/thirdparty/openxr/src/common/unique_asset.h new file mode 100644 index 0000000000..4929039a03 --- /dev/null +++ b/thirdparty/openxr/src/common/unique_asset.h @@ -0,0 +1,33 @@ +// Copyright (c) 2017-2022, The Khronos Group Inc. +// +// SPDX-License-Identifier: Apache-2.0 OR MIT +#pragma once + +#ifdef XR_USE_PLATFORM_ANDROID + +#include <memory> +#include <android/asset_manager.h> + +namespace deleters { +struct AAssetDeleter { + void operator()(AAsset* asset) const noexcept { + if (asset != nullptr) { + AAsset_close(asset); + } + } +}; + +struct AAssetDirDeleter { + void operator()(AAssetDir* dir) const noexcept { + if (dir != nullptr) { + AAssetDir_close(dir); + } + } +}; + +} // namespace deleters + +using UniqueAsset = std::unique_ptr<AAsset, deleters::AAssetDeleter>; +using UniqueAssetDir = std::unique_ptr<AAssetDir, deleters::AAssetDirDeleter>; + +#endif diff --git a/thirdparty/openxr/src/common/xr_linear.h b/thirdparty/openxr/src/common/xr_linear.h index 9ffb49a4b6..1f0e803b7a 100644 --- a/thirdparty/openxr/src/common/xr_linear.h +++ b/thirdparty/openxr/src/common/xr_linear.h @@ -126,12 +126,12 @@ static const XrColor4f XrColorCyan = {0.0f, 1.0f, 1.0f, 1.0f}; static const XrColor4f XrColorLightGrey = {0.7f, 0.7f, 0.7f, 1.0f}; static const XrColor4f XrColorDarkGrey = {0.3f, 0.3f, 0.3f, 1.0f}; -enum GraphicsAPI { GRAPHICS_VULKAN, GRAPHICS_OPENGL, GRAPHICS_OPENGL_ES, GRAPHICS_D3D }; +typedef enum GraphicsAPI { GRAPHICS_VULKAN, GRAPHICS_OPENGL, GRAPHICS_OPENGL_ES, GRAPHICS_D3D } GraphicsAPI; // Column-major, pre-multiplied. This type does not exist in the OpenXR API and is provided for convenience. -struct XrMatrix4x4f { +typedef struct XrMatrix4x4f { float m[16]; -}; +} XrMatrix4x4f; inline static float XrRcpSqrt(const float x) { const float SMALLEST_NON_DENORMAL = 1.1754943508222875e-038f; // ( 1U << 23 ) |