From cf98037532b14b5254259b91fbf059703b89bb63 Mon Sep 17 00:00:00 2001 From: Lubos Date: Mon, 10 Feb 2025 18:04:53 +0100 Subject: [PATCH] OpenXR - NonVR option fixed --- Common/VR/PPSSPPVR.cpp | 20 +++++++++++--------- Common/VR/PPSSPPVR.h | 1 + GPU/GLES/ShaderManagerGLES.cpp | 4 +++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index bdc87e2721..da39412c60 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -508,12 +508,6 @@ bool StartVRRender() { if (VR_InitFrame(VR_GetEngine())) { - // VR flags - bool vrIncompatibleGame = PSP_CoreParameter().compat.vrCompat().ForceFlatScreen; - bool vrMode = (g_Config.bEnableVR || IsImmersiveVRMode()) && !vrIncompatibleGame; - bool vrScene = !vrFlatForced && (g_Config.bManualForceVR || (vr3DGeometryCount > 15)); - bool vrStereo = !PSP_CoreParameter().compat.vrCompat().ForceMono && g_Config.bEnableStereo; - // Get VR status for (int eye = 0; eye < ovrMaxNumEyes; eye++) { vrView[eye] = VR_GetView(eye); @@ -548,7 +542,8 @@ bool StartVRRender() { // Decide if the scene is 3D or not VR_SetConfigFloat(VR_CONFIG_CANVAS_ASPECT, 480.0f / 272.0f); - if (vrMode && vrScene && (appMode == VR_GAME_MODE)) { + bool vrStereo = !PSP_CoreParameter().compat.vrCompat().ForceMono && g_Config.bEnableStereo; + if (!IsBigScreenVRMode() && (appMode == VR_GAME_MODE)) { VR_SetConfig(VR_CONFIG_MODE, vrStereo ? VR_MODE_STEREO_6DOF : VR_MODE_MONO_6DOF); VR_SetConfig(VR_CONFIG_REPROJECTION, IsImmersiveVRMode() ? 0 : 1); vrFlatGame = false; @@ -566,7 +561,7 @@ bool StartVRRender() { vrCompat[VR_COMPAT_SKYPLANE] = PSP_CoreParameter().compat.vrCompat().Skyplane; // Set customizations - VR_SetConfigFloat(VR_CONFIG_CANVAS_DISTANCE, vrScene && (appMode == VR_GAME_MODE) ? g_Config.fCanvas3DDistance : g_Config.fCanvasDistance); + VR_SetConfigFloat(VR_CONFIG_CANVAS_DISTANCE, !IsBigScreenVRMode() && (appMode == VR_GAME_MODE) ? g_Config.fCanvas3DDistance : g_Config.fCanvasDistance); VR_SetConfig(VR_CONFIG_PASSTHROUGH, g_Config.bPassthrough && IsPassthroughSupported()); return true; } @@ -599,6 +594,13 @@ bool IsPassthroughSupported() { return VR_GetPlatformFlag(VR_PLATFORM_EXTENSION_PASSTHROUGH); } +bool IsBigScreenVRMode() { + bool vrIncompatibleGame = PSP_CoreParameter().compat.vrCompat().ForceFlatScreen; + bool vrMode = (g_Config.bEnableVR || IsImmersiveVRMode()) && !vrIncompatibleGame; + bool vrScene = !vrFlatForced && (g_Config.bManualForceVR || (vr3DGeometryCount > 15)); + return !vrMode || !vrScene; +} + bool IsFlatVRGame() { return vrFlatGame; } @@ -691,7 +693,7 @@ void UpdateVRParams(float* projMatrix) { void UpdateVRProjection(float* projMatrix, float* output) { for (int i = 0; i < 16; i++) { - if (!IsVREnabled()) { + if (!IsVREnabled() || IsBigScreenVRMode()) { output[i] = projMatrix[i]; } else if (PSP_CoreParameter().compat.vrCompat().ProjectionHack && ((i == 8) || (i == 9))) { output[i] = 0; diff --git a/Common/VR/PPSSPPVR.h b/Common/VR/PPSSPPVR.h index 3fa4da915f..d2a8f087eb 100644 --- a/Common/VR/PPSSPPVR.h +++ b/Common/VR/PPSSPPVR.h @@ -53,6 +53,7 @@ void PostVRFrameRender(); int GetVRFBOIndex(); int GetVRPassesCount(); bool IsPassthroughSupported(); +bool IsBigScreenVRMode(); bool IsFlatVRGame(); bool IsFlatVRScene(); bool IsGameVRScene(); diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index de60daa495..830a3d324f 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -341,8 +341,10 @@ static inline void FlipProjMatrix(Matrix4x4 &in, bool useBufferedRendering) { static inline bool GuessVRDrawingHUD(bool is2D, bool flatScreen) { bool hud = true; + //HUD shouldn't be modified in nonVR mode + if (IsBigScreenVRMode()) hud = false; //HUD can be disabled in settings - if (!g_Config.bRescaleHUD) hud = false; + else if (!g_Config.bRescaleHUD) hud = false; //HUD cannot be rendered in flatscreen else if (flatScreen) hud = false; //HUD has to be 2D