mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 05:00:27 +02:00
Added Android Meta Quest Support
This commit is contained in:
1 parent
49b8602543
commit
e52227baf5
67 files changed
+5662
-176
No files matched your search
@@ -0,0 +1,78 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(MKW_ENABLE_OPENXR) && defined(__ANDROID__)
|
||||
|
||||
#include "vr/openxr_backend.h"
|
||||
#include "vr/openxr_runtime.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace mkw::vr {
|
||||
|
||||
struct OpenXRVulkanGraphicsRequirements {
|
||||
// XR_MAKE_VERSION-encoded bounds reported by xrGetVulkanGraphicsRequirements2KHR.
|
||||
XrVersion min_api_version = 0;
|
||||
XrVersion max_api_version = 0;
|
||||
// Which binding extension was negotiated: XR_KHR_vulkan_enable2 when the
|
||||
// runtime offers it, otherwise the original XR_KHR_vulkan_enable.
|
||||
bool uses_enable2 = false;
|
||||
};
|
||||
|
||||
// Two-device Dawn/OpenXR Vulkan backend for Android (Meta Quest).
|
||||
//
|
||||
// Method surface and threading rules are identical to OpenXRD3D12Backend so the
|
||||
// pacing thread in openxr_integration.cpp is shared. The difference is behind
|
||||
// BindAurora: instead of binding Dawn's device to the session, this backend
|
||||
// creates its own VkInstance/VkDevice through the OpenXR runtime, owns a small
|
||||
// ring of AHardwareBuffers per eye, and hands them to Aurora's Vulkan stereo
|
||||
// bridge (aurora/vulkan_interop.h). When Aurora reports a completed copy, the
|
||||
// backend copies the buffer into the acquired XrSwapchain image on the
|
||||
// session's queue, so the compositor sees ordinary same-queue rendering.
|
||||
//
|
||||
// QueryGraphicsRequirements() runs after OpenXRRuntime::Initialize() and before
|
||||
// aurora_initialize(); BindAurora() runs afterwards, while Aurora's frame worker
|
||||
// is idle. Everything from BeginFrame() through FinishFrame() belongs to one XR
|
||||
// pacing thread; the Aurora callback only records a small copy on this
|
||||
// backend's private queue and publishes a token.
|
||||
class OpenXRVulkanBackend final {
|
||||
public:
|
||||
explicit OpenXRVulkanBackend(OpenXRLogCallback logger = {});
|
||||
~OpenXRVulkanBackend();
|
||||
|
||||
OpenXRVulkanBackend(const OpenXRVulkanBackend&) = delete;
|
||||
OpenXRVulkanBackend& operator=(const OpenXRVulkanBackend&) = delete;
|
||||
OpenXRVulkanBackend(OpenXRVulkanBackend&&) = delete;
|
||||
OpenXRVulkanBackend& operator=(OpenXRVulkanBackend&&) = delete;
|
||||
|
||||
bool QueryGraphicsRequirements(OpenXRRuntime& runtime);
|
||||
bool BindAurora(OpenXRRuntime& runtime);
|
||||
|
||||
OpenXRBeginStatus BeginFrame(const OpenXRPresentation& presentation, OpenXRBackendFrame& frame);
|
||||
OpenXRSubmissionStatus WaitForSubmission(const OpenXRBackendFrame& frame,
|
||||
uint32_t timeout_ms = UINT32_MAX);
|
||||
bool TryCancelPendingFrame(OpenXRBackendFrame& frame);
|
||||
bool RepeatFrame(const OpenXRBackendFrame& frame);
|
||||
bool FinishFrame(OpenXRBackendFrame& frame, bool submit_layer);
|
||||
|
||||
// Drains this backend's own queue before tearing down. Returns false only
|
||||
// when the private device could not be waited on, in which case the caller
|
||||
// retains the backend and runtime for the process lifetime.
|
||||
bool Shutdown();
|
||||
|
||||
bool IsBound() const;
|
||||
const OpenXRVulkanGraphicsRequirements& GraphicsRequirements() const;
|
||||
int64_t SwapchainFormat() const;
|
||||
const std::string& LastError() const;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
};
|
||||
|
||||
} // namespace mkw::vr
|
||||
|
||||
#endif // defined(MKW_ENABLE_OPENXR) && defined(__ANDROID__)
|
||||
Reference in new issue
Block a user