From ec0cba795118e8a132cf3339f14b99bfd3b62f9b Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 25 Dec 2024 21:23:01 +0100 Subject: [PATCH] OpenXR - Remove non-functional Vulkan implementation --- Common/GPU/Vulkan/VulkanQueueRunner.cpp | 8 +- Common/GPU/Vulkan/VulkanRenderManager.cpp | 12 +- Common/VR/OpenXRLoader.h | 11 -- Common/VR/PPSSPPVR.cpp | 21 +-- Common/VR/PPSSPPVR.h | 2 +- Common/VR/VRBase.cpp | 56 +++----- Common/VR/VRBase.h | 7 +- Common/VR/VRFramebuffer.cpp | 162 ++++------------------ Common/VR/VRFramebuffer.h | 2 +- Common/VR/VRRenderer.cpp | 6 +- 10 files changed, 51 insertions(+), 236 deletions(-) diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.cpp b/Common/GPU/Vulkan/VulkanQueueRunner.cpp index 867dccacf996..b8c6e5895de0 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.cpp +++ b/Common/GPU/Vulkan/VulkanQueueRunner.cpp @@ -3,7 +3,6 @@ #include "Common/GPU/DataFormat.h" #include "Common/GPU/Vulkan/VulkanQueueRunner.h" #include "Common/GPU/Vulkan/VulkanRenderManager.h" -#include "Common/VR/PPSSPPVR.h" #include "Common/Log.h" #include "Common/TimeUtil.h" @@ -1327,12 +1326,7 @@ VKRRenderPass *VulkanQueueRunner::PerformBindFramebufferAsRenderTarget(const VKR VKRRenderPassStoreAction::STORE, VKRRenderPassStoreAction::DONT_CARE, VKRRenderPassStoreAction::DONT_CARE, }; renderPass = GetRenderPass(key); - - if (IsVREnabled()) { - framebuf = (VkFramebuffer)BindVRFramebuffer(); - } else { - framebuf = backbuffer_; - } + framebuf = backbuffer_; // Raw, rotated backbuffer size. w = vulkan_->GetBackbufferWidth(); diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 9639650c953b..0735319977de 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -13,7 +13,6 @@ #include "Common/LogReporting.h" #include "Common/Thread/ThreadUtil.h" -#include "Common/VR/PPSSPPVR.h" #if 0 // def _DEBUG #define VLOG(...) NOTICE_LOG(Log::G3D, __VA_ARGS__) @@ -1534,16 +1533,7 @@ void VulkanRenderManager::Run(VKRRenderThreadTask &task) { if (task.steps.empty() && !frameData.hasAcquired) frameData.skipSwap = true; //queueRunner_.LogSteps(stepsOnThread, false); - if (IsVREnabled()) { - int passes = GetVRPassesCount(); - for (int i = 0; i < passes; i++) { - PreVRFrameRender(i); - queueRunner_.RunSteps(task.steps, task.frame, frameData, frameDataShared_, i < passes - 1); - PostVRFrameRender(); - } - } else { - queueRunner_.RunSteps(task.steps, task.frame, frameData, frameDataShared_); - } + queueRunner_.RunSteps(task.steps, task.frame, frameData, frameDataShared_); switch (task.runType) { case VKRRunType::SUBMIT: diff --git a/Common/VR/OpenXRLoader.h b/Common/VR/OpenXRLoader.h index 5a7acbe961e1..1cc6cf67baaa 100644 --- a/Common/VR/OpenXRLoader.h +++ b/Common/VR/OpenXRLoader.h @@ -1,18 +1,9 @@ #pragma once -//Vulkan -#ifdef VK_USE_NATIVE_LIB -#include -#else -#include "Common/GPU/Vulkan/VulkanLoader.h" -using namespace PPSSPP_VK; -#endif - #ifdef ANDROID #include #define XR_USE_PLATFORM_ANDROID 1 #define XR_USE_GRAPHICS_API_OPENGL_ES 1 -#define XR_USE_GRAPHICS_API_VULKAN 1 #include #include @@ -34,12 +25,10 @@ using namespace PPSSPP_VK; #define XR_USE_PLATFORM_WIN32 1 #endif #endif -#define XR_USE_GRAPHICS_API_VULKAN 1 #include "Common/VR/OpenXRLoader.h" #include #define XR_NO_PROTOTYPES 1 #else -#define XR_USE_GRAPHICS_API_VULKAN 1 #define XR_NO_PROTOTYPES 1 #endif diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index a77bce66634b..bdc87e27212b 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -12,8 +12,6 @@ #include "Common/Input/InputState.h" #include "Common/Input/KeyCodes.h" -#include "Common/GPU/Vulkan/VulkanContext.h" - #include "Common/Math/lin/matrix4x4.h" #include "Common/Input/InputState.h" @@ -162,7 +160,6 @@ void InitVROnAndroid(void* vm, void* activity, const char* system, int version, VR_SetPlatformFLag(VR_PLATFORM_EXTENSION_PERFORMANCE, true); VR_SetConfigFloat(VR_CONFIG_VIEWPORT_SUPERSAMPLING, 1.3f); } - VR_SetPlatformFLag(VR_PLATFORM_RENDERER_VULKAN, (GPUBackend)g_Config.iGPUBackend == GPUBackend::VULKAN); //Init VR ovrJava java; @@ -172,24 +169,10 @@ void InitVROnAndroid(void* vm, void* activity, const char* system, int version, } #endif -void EnterVR(bool firstStart, void* vulkanContext) { +void EnterVR(bool firstStart) { if (firstStart) { engine_t* engine = VR_GetEngine(); - bool useVulkan = (GPUBackend)g_Config.iGPUBackend == GPUBackend::VULKAN; - if (useVulkan) { - auto* context = (VulkanContext*)vulkanContext; - engine->graphicsBindingVulkan = {}; - engine->graphicsBindingVulkan.type = XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR; - engine->graphicsBindingVulkan.next = NULL; - engine->graphicsBindingVulkan.device = context->GetDevice(); - engine->graphicsBindingVulkan.instance = context->GetInstance(); - engine->graphicsBindingVulkan.physicalDevice = context->GetCurrentPhysicalDevice(); - engine->graphicsBindingVulkan.queueFamilyIndex = context->GetGraphicsQueueFamilyIndex(); - engine->graphicsBindingVulkan.queueIndex = 0; - VR_EnterVR(engine, &engine->graphicsBindingVulkan); - } else { - VR_EnterVR(engine, nullptr); - } + VR_EnterVR(engine); IN_VRInit(engine); } VR_SetConfig(VR_CONFIG_VIEWPORT_VALID, false); diff --git a/Common/VR/PPSSPPVR.h b/Common/VR/PPSSPPVR.h index e77f5a0d07b2..3fa4da915f09 100644 --- a/Common/VR/PPSSPPVR.h +++ b/Common/VR/PPSSPPVR.h @@ -30,7 +30,7 @@ enum VRAppMode { // VR app flow integration bool IsVREnabled(); void InitVROnAndroid(void* vm, void* activity, const char* system, int version, const char* name); -void EnterVR(bool firstStart, void* vulkanContext); +void EnterVR(bool firstStart); void GetVRResolutionPerEye(int* width, int* height); void SetVRCallbacks(void(*axis)(const AxisInput *axis, size_t count), bool(*key)(const KeyInput &key), void(*touch)(const TouchInput &touch)); diff --git a/Common/VR/VRBase.cpp b/Common/VR/VRBase.cpp index 37e5ff0153e8..c305bf160f7b 100644 --- a/Common/VR/VRBase.cpp +++ b/Common/VR/VRBase.cpp @@ -40,13 +40,9 @@ void VR_Init( void* system, const char* name, int version ) { #endif std::vector extensions; - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - extensions.push_back(XR_KHR_VULKAN_ENABLE_EXTENSION_NAME); - } else { #ifdef XR_USE_GRAPHICS_API_OPENGL_ES - extensions.push_back(XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME); + extensions.push_back(XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME); #endif - } extensions.push_back(XR_KHR_COMPOSITION_LAYER_CYLINDER_EXTENSION_NAME); #ifdef ANDROID if (VR_GetPlatformFlag(VR_PLATFORM_EXTENSION_INSTANCE)) { @@ -125,29 +121,17 @@ void VR_Init( void* system, const char* name, int version ) { } // Get the graphics requirements. - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - PFN_xrGetVulkanGraphicsRequirementsKHR pfnGetVulkanGraphicsRequirementsKHR = NULL; - OXR(xrGetInstanceProcAddr( - vr_engine.appState.Instance, - "xrGetVulkanGraphicsRequirementsKHR", - (PFN_xrVoidFunction*)(&pfnGetVulkanGraphicsRequirementsKHR))); - - XrGraphicsRequirementsVulkanKHR graphicsRequirements = {}; - graphicsRequirements.type = XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR; - OXR(pfnGetVulkanGraphicsRequirementsKHR(vr_engine.appState.Instance, systemId, &graphicsRequirements)); - } else { #ifdef XR_USE_GRAPHICS_API_OPENGL_ES - PFN_xrGetOpenGLESGraphicsRequirementsKHR pfnGetOpenGLESGraphicsRequirementsKHR = NULL; - OXR(xrGetInstanceProcAddr( - vr_engine.appState.Instance, - "xrGetOpenGLESGraphicsRequirementsKHR", - (PFN_xrVoidFunction*)(&pfnGetOpenGLESGraphicsRequirementsKHR))); - - XrGraphicsRequirementsOpenGLESKHR graphicsRequirements = {}; - graphicsRequirements.type = XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR; - OXR(pfnGetOpenGLESGraphicsRequirementsKHR(vr_engine.appState.Instance, systemId, &graphicsRequirements)); + PFN_xrGetOpenGLESGraphicsRequirementsKHR pfnGetOpenGLESGraphicsRequirementsKHR = NULL; + OXR(xrGetInstanceProcAddr( + vr_engine.appState.Instance, + "xrGetOpenGLESGraphicsRequirementsKHR", + (PFN_xrVoidFunction*)(&pfnGetOpenGLESGraphicsRequirementsKHR))); + + XrGraphicsRequirementsOpenGLESKHR graphicsRequirements = {}; + graphicsRequirements.type = XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR; + OXR(pfnGetOpenGLESGraphicsRequirementsKHR(vr_engine.appState.Instance, systemId, &graphicsRequirements)); #endif - } #ifdef ANDROID vr_engine.appState.MainThreadTid = gettid(); @@ -163,7 +147,7 @@ void VR_Destroy( engine_t* engine ) { } } -void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVulkan ) { +void VR_EnterVR( engine_t* engine ) { if (engine->appState.Session) { ALOGE("VR_EnterVR called with existing session"); @@ -178,20 +162,16 @@ void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVu XrGraphicsBindingOpenGLWin32KHR graphicsBindingGL = {}; #endif memset(&sessionCreateInfo, 0, sizeof(sessionCreateInfo)); - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - sessionCreateInfo.next = graphicsBindingVulkan; - } else { #ifdef ANDROID - graphicsBindingGL.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR; - graphicsBindingGL.next = NULL; - graphicsBindingGL.display = eglGetCurrentDisplay(); - graphicsBindingGL.config = NULL; - graphicsBindingGL.context = eglGetCurrentContext(); - sessionCreateInfo.next = &graphicsBindingGL; + graphicsBindingGL.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR; + graphicsBindingGL.next = NULL; + graphicsBindingGL.display = eglGetCurrentDisplay(); + graphicsBindingGL.config = NULL; + graphicsBindingGL.context = eglGetCurrentContext(); + sessionCreateInfo.next = &graphicsBindingGL; #else - //TODO:PCVR definition + //TODO:PCVR definition #endif - } sessionCreateInfo.type = XR_TYPE_SESSION_CREATE_INFO; sessionCreateInfo.createFlags = 0; sessionCreateInfo.systemId = engine->appState.SystemId; diff --git a/Common/VR/VRBase.h b/Common/VR/VRBase.h index 8340b25673a2..600f70b10c99 100644 --- a/Common/VR/VRBase.h +++ b/Common/VR/VRBase.h @@ -68,11 +68,8 @@ typedef struct { void* ColorSwapChainImage; unsigned int* GLDepthBuffers; unsigned int* GLFrameBuffers; - VkFramebuffer* VKFrameBuffers; - VkImageView* VKColorImages; bool Acquired; - XrGraphicsBindingVulkanKHR* VKContext; } ovrFramebuffer; typedef struct { @@ -115,7 +112,6 @@ typedef struct { uint64_t frameIndex; ovrApp appState; XrTime predictedDisplayTime; - XrGraphicsBindingVulkanKHR graphicsBindingVulkan; } engine_t; enum VRPlatformFlag { @@ -124,14 +120,13 @@ enum VRPlatformFlag { VR_PLATFORM_EXTENSION_INSTANCE, VR_PLATFORM_EXTENSION_PASSTHROUGH, VR_PLATFORM_EXTENSION_PERFORMANCE, - VR_PLATFORM_RENDERER_VULKAN, VR_PLATFORM_TRACKING_FLOOR, VR_PLATFORM_MAX }; void VR_Init( void* system, const char* name, int version ); void VR_Destroy( engine_t* engine ); -void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVulkan ); +void VR_EnterVR( engine_t* engine ); void VR_LeaveVR( engine_t* engine ); engine_t* VR_GetEngine( void ); diff --git a/Common/VR/VRFramebuffer.cpp b/Common/VR/VRFramebuffer.cpp index 0a91bd2082ae..21e5d3ed0ed4 100644 --- a/Common/VR/VRFramebuffer.cpp +++ b/Common/VR/VRFramebuffer.cpp @@ -153,105 +153,13 @@ static bool ovrFramebuffer_CreateGL(XrSession session, ovrFramebuffer* frameBuff #endif -#if XR_USE_GRAPHICS_API_VULKAN - -static bool ovrFramebuffer_CreateVK(XrSession session, ovrFramebuffer* frameBuffer, int width, int height, - void* context) { - - frameBuffer->Width = width; - frameBuffer->Height = height; - frameBuffer->VKContext = (XrGraphicsBindingVulkanKHR*)context; - - XrSwapchainCreateInfo swapChainCreateInfo; - memset(&swapChainCreateInfo, 0, sizeof(swapChainCreateInfo)); - swapChainCreateInfo.type = XR_TYPE_SWAPCHAIN_CREATE_INFO; - swapChainCreateInfo.sampleCount = 1; - swapChainCreateInfo.width = width; - swapChainCreateInfo.height = height; - swapChainCreateInfo.faceCount = 1; - swapChainCreateInfo.mipCount = 1; - swapChainCreateInfo.arraySize = 1; - - frameBuffer->ColorSwapChain.Width = swapChainCreateInfo.width; - frameBuffer->ColorSwapChain.Height = swapChainCreateInfo.height; - - // Create the color swapchain. - swapChainCreateInfo.format = VK_FORMAT_R8G8B8A8_UNORM; - swapChainCreateInfo.usageFlags = XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT; - OXR(xrCreateSwapchain(session, &swapChainCreateInfo, &frameBuffer->ColorSwapChain.Handle)); - OXR(xrEnumerateSwapchainImages(frameBuffer->ColorSwapChain.Handle, 0, &frameBuffer->TextureSwapChainLength, NULL)); - frameBuffer->ColorSwapChainImage = malloc(frameBuffer->TextureSwapChainLength * sizeof(XrSwapchainImageVulkanKHR)); - - // Populate the swapchain image array. - for (uint32_t i = 0; i < frameBuffer->TextureSwapChainLength; i++) { - ((XrSwapchainImageVulkanKHR*)frameBuffer->ColorSwapChainImage)[i].type = XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR; - ((XrSwapchainImageVulkanKHR*)frameBuffer->ColorSwapChainImage)[i].next = NULL; - } - OXR(xrEnumerateSwapchainImages( - frameBuffer->ColorSwapChain.Handle, - frameBuffer->TextureSwapChainLength, - &frameBuffer->TextureSwapChainLength, - (XrSwapchainImageBaseHeader*)frameBuffer->ColorSwapChainImage)); - - frameBuffer->VKColorImages = new VkImageView[frameBuffer->TextureSwapChainLength]; - frameBuffer->VKFrameBuffers = new VkFramebuffer[frameBuffer->TextureSwapChainLength]; - for (uint32_t i = 0; i < frameBuffer->TextureSwapChainLength; i++) { - VkImageViewCreateInfo createInfo{}; - createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; - createInfo.image = ((XrSwapchainImageVulkanKHR*)frameBuffer->ColorSwapChainImage)[i].image; - createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; - createInfo.format = VK_FORMAT_R8G8B8A8_UNORM; - createInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; - createInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; - createInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; - createInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; - createInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - createInfo.subresourceRange.baseMipLevel = 0; - createInfo.subresourceRange.levelCount = 1; - createInfo.subresourceRange.baseArrayLayer = 0; - createInfo.subresourceRange.layerCount = swapChainCreateInfo.arraySize; - if (vkCreateImageView(frameBuffer->VKContext->device, &createInfo, nullptr, &frameBuffer->VKColorImages[i]) != VK_SUCCESS) { - ALOGE("failed to create color image view!"); - return false; - } - - // Create the frame buffer. - VkImageView attachments[] = { frameBuffer->VKColorImages[i] }; - VkFramebufferCreateInfo framebufferInfo{}; - framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO; - framebufferInfo.renderPass = VK_NULL_HANDLE; //TODO:This is probably wrong - framebufferInfo.attachmentCount = 2; - framebufferInfo.pAttachments = attachments; - framebufferInfo.width = width; - framebufferInfo.height = height; - framebufferInfo.layers = swapChainCreateInfo.arraySize; - if (vkCreateFramebuffer(frameBuffer->VKContext->device, &framebufferInfo, nullptr, &frameBuffer->VKFrameBuffers[i]) != VK_SUCCESS) { - ALOGE("failed to create framebuffer!"); - return false; - } - } - - return true; -} - -#endif - void ovrFramebuffer_Destroy(ovrFramebuffer* frameBuffer) { - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - for (int i = 0; i < (int)frameBuffer->TextureSwapChainLength; i++) { - vkDestroyImageView(frameBuffer->VKContext->device, frameBuffer->VKColorImages[i], nullptr); - vkDestroyFramebuffer(frameBuffer->VKContext->device, frameBuffer->VKFrameBuffers[i], nullptr); - } - delete[] frameBuffer->VKColorImages; - delete[] frameBuffer->VKFrameBuffers; - } else { #if XR_USE_GRAPHICS_API_OPENGL_ES || XR_USE_GRAPHICS_API_OPENGL - GL(glDeleteRenderbuffers(frameBuffer->TextureSwapChainLength, frameBuffer->GLDepthBuffers)); - GL(glDeleteFramebuffers(frameBuffer->TextureSwapChainLength, frameBuffer->GLFrameBuffers)); - free(frameBuffer->GLDepthBuffers); - free(frameBuffer->GLFrameBuffers); + GL(glDeleteRenderbuffers(frameBuffer->TextureSwapChainLength, frameBuffer->GLDepthBuffers)); + GL(glDeleteFramebuffers(frameBuffer->TextureSwapChainLength, frameBuffer->GLFrameBuffers)); + free(frameBuffer->GLDepthBuffers); + free(frameBuffer->GLFrameBuffers); #endif - } OXR(xrDestroySwapchain(frameBuffer->ColorSwapChain.Handle)); free(frameBuffer->ColorSwapChainImage); @@ -259,14 +167,10 @@ void ovrFramebuffer_Destroy(ovrFramebuffer* frameBuffer) { } void* ovrFramebuffer_SetCurrent(ovrFramebuffer* frameBuffer) { - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - return (void *)frameBuffer->VKFrameBuffers[frameBuffer->TextureSwapChainIndex]; - } else { #if XR_USE_GRAPHICS_API_OPENGL_ES || XR_USE_GRAPHICS_API_OPENGL - GL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer->GLFrameBuffers[frameBuffer->TextureSwapChainIndex])); + GL(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer->GLFrameBuffers[frameBuffer->TextureSwapChainIndex])); #endif - return nullptr; - } + return nullptr; } void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer) { @@ -282,19 +186,15 @@ void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer) { ovrFramebuffer_SetCurrent(frameBuffer); - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - //TODO:implement - } else { #if XR_USE_GRAPHICS_API_OPENGL_ES || XR_USE_GRAPHICS_API_OPENGL - GL(glEnable( GL_SCISSOR_TEST )); - GL(glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height )); - GL(glClearColor( 0.0f, 0.0f, 0.0f, 1.0f )); - GL(glScissor( 0, 0, frameBuffer->Width, frameBuffer->Height )); - GL(glClear( GL_COLOR_BUFFER_BIT )); - GL(glScissor( 0, 0, 0, 0 )); - GL(glDisable( GL_SCISSOR_TEST )); + GL(glEnable( GL_SCISSOR_TEST )); + GL(glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height )); + GL(glClearColor( 0.0f, 0.0f, 0.0f, 1.0f )); + GL(glScissor( 0, 0, frameBuffer->Width, frameBuffer->Height )); + GL(glClear( GL_COLOR_BUFFER_BIT )); + GL(glScissor( 0, 0, 0, 0 )); + GL(glDisable( GL_SCISSOR_TEST )); #endif - } } void ovrFramebuffer_Release(ovrFramebuffer* frameBuffer) { @@ -304,16 +204,12 @@ void ovrFramebuffer_Release(ovrFramebuffer* frameBuffer) { frameBuffer->Acquired = false; // Clear the alpha channel, other way OpenXR would not transfer the framebuffer fully - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - //TODO:implement - } else { #if XR_USE_GRAPHICS_API_OPENGL_ES || XR_USE_GRAPHICS_API_OPENGL - GL(glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE)); - GL(glClearColor(0.0f, 0.0f, 0.0f, 1.0f)); - GL(glClear(GL_COLOR_BUFFER_BIT)); - GL(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); + GL(glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE)); + GL(glClearColor(0.0f, 0.0f, 0.0f, 1.0f)); + GL(glClear(GL_COLOR_BUFFER_BIT)); + GL(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)); #endif - } } } @@ -331,15 +227,11 @@ void ovrRenderer_Clear(ovrRenderer* renderer) { } } -void ovrRenderer_Create(XrSession session, ovrRenderer* renderer, int width, int height, void* vulkanContext) { +void ovrRenderer_Create(XrSession session, ovrRenderer* renderer, int width, int height) { for (int i = 0; i < ovrMaxNumEyes; i++) { - if (vulkanContext) { - ovrFramebuffer_CreateVK(session, &renderer->FrameBuffer[i], width, height, vulkanContext); - } else { #if XR_USE_GRAPHICS_API_OPENGL_ES || XR_USE_GRAPHICS_API_OPENGL - ovrFramebuffer_CreateGL(session, &renderer->FrameBuffer[i], width, height); + ovrFramebuffer_CreateGL(session, &renderer->FrameBuffer[i], width, height); #endif - } } } @@ -350,18 +242,14 @@ void ovrRenderer_Destroy(ovrRenderer* renderer) { } void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int sx, int sy) { - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - //TODO:implement - } else { #if XR_USE_GRAPHICS_API_OPENGL_ES || XR_USE_GRAPHICS_API_OPENGL - GL(glEnable(GL_SCISSOR_TEST)); - GL(glScissor(x, y, sx, sy)); - GL(glViewport(x, y, sx, sy)); - GL(glClearColor(1.0f, 1.0f, 1.0f, 1.0f)); - GL(glClear(GL_COLOR_BUFFER_BIT)); - GL(glDisable(GL_SCISSOR_TEST)); + GL(glEnable(GL_SCISSOR_TEST)); + GL(glScissor(x, y, sx, sy)); + GL(glViewport(x, y, sx, sy)); + GL(glClearColor(1.0f, 1.0f, 1.0f, 1.0f)); + GL(glClear(GL_COLOR_BUFFER_BIT)); + GL(glDisable(GL_SCISSOR_TEST)); #endif - } } /* diff --git a/Common/VR/VRFramebuffer.h b/Common/VR/VRFramebuffer.h index c49594b21ef8..fc7a550778f8 100644 --- a/Common/VR/VRFramebuffer.h +++ b/Common/VR/VRFramebuffer.h @@ -10,6 +10,6 @@ void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer); void ovrFramebuffer_Release(ovrFramebuffer* frameBuffer); void* ovrFramebuffer_SetCurrent(ovrFramebuffer* frameBuffer); -void ovrRenderer_Create(XrSession session, ovrRenderer* renderer, int width, int height, void* vulkanContext); +void ovrRenderer_Create(XrSession session, ovrRenderer* renderer, int width, int height); void ovrRenderer_Destroy(ovrRenderer* renderer); void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int sx, int sy); diff --git a/Common/VR/VRRenderer.cpp b/Common/VR/VRRenderer.cpp index 36052af4ade9..926ac4f55f60 100644 --- a/Common/VR/VRRenderer.cpp +++ b/Common/VR/VRRenderer.cpp @@ -237,11 +237,7 @@ void VR_InitRenderer( engine_t* engine ) { projections[eye].type = XR_TYPE_VIEW; } - void* vulkanContext = nullptr; - if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) { - vulkanContext = &engine->graphicsBindingVulkan; - } - ovrRenderer_Create(engine->appState.Session, &engine->appState.Renderer, eyeW, eyeH, vulkanContext); + ovrRenderer_Create(engine->appState.Session, &engine->appState.Renderer, eyeW, eyeH); if (VR_GetPlatformFlag(VRPlatformFlag::VR_PLATFORM_EXTENSION_PASSTHROUGH)) { XrPassthroughCreateInfoFB ptci = {XR_TYPE_PASSTHROUGH_CREATE_INFO_FB};