diff --git a/Common/GPU/OpenGL/GLQueueRunner.cpp b/Common/GPU/OpenGL/GLQueueRunner.cpp index f6ca57725c..253df013fe 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.cpp +++ b/Common/GPU/OpenGL/GLQueueRunner.cpp @@ -14,7 +14,6 @@ #include "Common/Data/Convert/SmallDataConvert.h" #include "Core/Reporting.h" -#include "Core/System.h" #include "GLQueueRunner.h" #include "GLRenderManager.h" #include "DataFormatGL.h" @@ -771,11 +770,8 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last PerformBindFramebufferAsRenderTarget(step); - if (IsVRBuild() && PSP_CoreParameter().compat.flags().VRClearFramebuffer) { - if ((strcmp(step.tag, "FramebufferSwitch") == 0) && (step.commands.size() > 50)) { - glClearColor(0.5f, 0.75f, 1.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - } + if (IsVRBuild()) { + PreGLRenderPass(step); } if (first) { diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index 16b170e1fb..23f4c2d550 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -8,7 +8,9 @@ #include "Core/HLE/sceDisplay.h" #include "Core/Config.h" #include "Core/KeyMap.h" +#include "Core/System.h" +static long vrCompat[VR_COMPAT_MAX]; /* ================================================================================ @@ -210,6 +212,31 @@ void UpdateVRScreenKey(const KeyInput &key) { /* ================================================================================ +// VR games compatibility + +================================================================================ +*/ + +void PreGLRenderPass(const GLRStep& step) { + if (vrCompat[VR_COMPAT_SKYPLANE]) { + if (strcmp(step.tag, "FramebufferSwitch") == 0) { + glClearColor(0, 0, 0, 1); + glClear(GL_COLOR_BUFFER_BIT); + } + } +} + +long GetVRCompat(VRCompat flag) { + return vrCompat[flag]; +} + +void SetVRCompat(VRCompat flag, long value) { + vrCompat[flag] = value; +} + +/* +================================================================================ + VR rendering integration ================================================================================ @@ -235,6 +262,9 @@ bool PreVRRender() { } VR_SetConfig(VR_CONFIG_3D_GEOMETRY_COUNT, VR_GetConfig(VR_CONFIG_3D_GEOMETRY_COUNT) / 2); + // Set compatibility + vrCompat[VR_COMPAT_SKYPLANE] = PSP_CoreParameter().compat.flags().VRSkyplane; + // Set customizations VR_SetConfig(VR_CONFIG_6DOF_ENABLED, g_Config.bEnable6DoF); VR_SetConfig(VR_CONFIG_CANVAS_DISTANCE, g_Config.iCanvasDistance); diff --git a/Common/VR/PPSSPPVR.h b/Common/VR/PPSSPPVR.h index b41b69f1be..8ce9ca26b0 100644 --- a/Common/VR/PPSSPPVR.h +++ b/Common/VR/PPSSPPVR.h @@ -2,6 +2,15 @@ #include "Common/Input/InputState.h" #include "Common/Input/KeyCodes.h" +#include "GPU/OpenGL/GLQueueRunner.h" + +enum VRCompat { + //compatibility tweaks + VR_COMPAT_SKYPLANE, + + //end + VR_COMPAT_MAX +}; #ifdef OPENXR @@ -13,6 +22,11 @@ void GetVRResolutionPerEye(int* width, int* height); void UpdateVRInput(bool(*NativeKey)(const KeyInput &key), bool(*NativeTouch)(const TouchInput &touch), bool haptics, float dp_xscale, float dp_yscale); void UpdateVRScreenKey(const KeyInput &key); +// VR games compatibility +void PreGLRenderPass(const GLRStep& step); +long GetVRCompat(VRCompat flag); +void SetVRCompat(VRCompat flag, long value); + // VR rendering integration void BindVRFramebuffer(); bool PreVRRender(); @@ -36,6 +50,11 @@ inline void GetVRResolutionPerEye(int* width, int* height) {} inline void UpdateVRInput(bool(*NativeKey)(const KeyInput &key), bool(*NativeTouch)(const TouchInput &touch), bool haptics, float dp_xscale, float dp_yscale) {} inline void UpdateVRScreenKey(const KeyInput &key) {} +// VR games compatibility +inline void PreGLRenderPass(const GLRStep& step) {} +inline long GetVRCompat(VRCompat flag) { return 0; } +inline void SetVRCompat(VRCompat flag, long value) {} + // VR rendering integration inline void BindVRFramebuffer() {} inline bool PreVRRender() { return false; } diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index 00608ceb7c..d46a93e850 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -98,7 +98,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "DeswizzleDepth", &flags_.DeswizzleDepth); CheckSetting(iniFile, gameID, "SplitFramebufferMargin", &flags_.SplitFramebufferMargin); CheckSetting(iniFile, gameID, "ForceLowerResolutionForEffectsOn", &flags_.ForceLowerResolutionForEffectsOn); - CheckSetting(iniFile, gameID, "VRClearFramebuffer", &flags_.VRClearFramebuffer); + CheckSetting(iniFile, gameID, "VRSkyplane", &flags_.VRSkyplane); } void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index f5e3dc0c31..07a2b99be0 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -88,7 +88,7 @@ struct CompatFlags { bool DeswizzleDepth; bool SplitFramebufferMargin; bool ForceLowerResolutionForEffectsOn; - bool VRClearFramebuffer; + bool VRSkyplane; }; class IniFile; diff --git a/assets/compat.ini b/assets/compat.ini index 2c2d430dc6..3c10463505 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1295,7 +1295,7 @@ ULES00262 = true ULUS10064 = true ULKS46087 = true -[VRClearFramebuffer] +[VRSkyplane] # Grand Theft Auto: Liberty City Stories ULUS10041 = true ULES00151 = true