mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-03-04 20:27:57 +00:00
OpenXR - Refactor VR compat integration
This commit is contained in:
parent
4ff3e496c5
commit
4b129bb9c3
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
@ -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) {
|
||||
|
@ -88,7 +88,7 @@ struct CompatFlags {
|
||||
bool DeswizzleDepth;
|
||||
bool SplitFramebufferMargin;
|
||||
bool ForceLowerResolutionForEffectsOn;
|
||||
bool VRClearFramebuffer;
|
||||
bool VRSkyplane;
|
||||
};
|
||||
|
||||
class IniFile;
|
||||
|
@ -1295,7 +1295,7 @@ ULES00262 = true
|
||||
ULUS10064 = true
|
||||
ULKS46087 = true
|
||||
|
||||
[VRClearFramebuffer]
|
||||
[VRSkyplane]
|
||||
# Grand Theft Auto: Liberty City Stories
|
||||
ULUS10041 = true
|
||||
ULES00151 = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user