diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index f3b34dd7d1..3ec28c61ae 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -60,6 +60,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "ForceRangeDownload", &flags_.ForceRangeDownload); CheckSetting(iniFile, gameID, "FlushAtStall", &flags_.FlushAtStall); CheckSetting(iniFile, gameID, "Force04Download", &flags_.Force04Download); + CheckSetting(iniFile, gameID, "GuardBand", &flags_.GuardBand); CheckSetting(iniFile, gameID, "RequireBufferedRendering", &flags_.RequireBufferedRendering); CheckSetting(iniFile, gameID, "RequireBlockTransfer", &flags_.RequireBlockTransfer); } diff --git a/Core/Compatibility.h b/Core/Compatibility.h index 754eda949a..3f241651ea 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -62,6 +62,7 @@ struct CompatFlags { bool ForceRangeDownload; bool FlushAtStall; bool Force04Download; + bool GuardBand; }; class IniFile; diff --git a/GPU/Directx9/VertexShaderGeneratorDX9.cpp b/GPU/Directx9/VertexShaderGeneratorDX9.cpp index b87f9fdedc..c5fac70801 100644 --- a/GPU/Directx9/VertexShaderGeneratorDX9.cpp +++ b/GPU/Directx9/VertexShaderGeneratorDX9.cpp @@ -424,7 +424,8 @@ void GenerateVertexShaderHLSL(const ShaderID &id, char *buffer, ShaderLanguage l } } if (lang != HLSL_DX9) { - WriteGuardBand(p); + if (PSP_CoreParameter().compat.flags().GuardBand) + WriteGuardBand(p); } WRITE(p, " Out.gl_Position = outPos;\n"); } else { @@ -625,7 +626,8 @@ void GenerateVertexShaderHLSL(const ShaderID &id, char *buffer, ShaderLanguage l WRITE(p, " float4 outPos = mul(viewPos, u_proj);\n"); } } - WriteGuardBand(p); + if (PSP_CoreParameter().compat.flags().GuardBand) + WriteGuardBand(p); WRITE(p, " Out.gl_Position = outPos;\n"); // TODO: Declare variables for dots for shade mapping if needed. diff --git a/GPU/GLES/VertexShaderGeneratorGLES.cpp b/GPU/GLES/VertexShaderGeneratorGLES.cpp index 571915f0de..92c2f75a2c 100644 --- a/GPU/GLES/VertexShaderGeneratorGLES.cpp +++ b/GPU/GLES/VertexShaderGeneratorGLES.cpp @@ -469,7 +469,8 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) { WRITE(p, " vec4 outPos = u_proj * vec4(position.xyz, 1.0);\n"); } } - WriteGuardBand(p); + if (PSP_CoreParameter().compat.flags().GuardBand) + WriteGuardBand(p); WRITE(p, " gl_Position = outPos;\n"); } else { // Step 1: World Transform / Skinning @@ -666,7 +667,8 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) { } else { WRITE(p, " vec4 outPos = u_proj * viewPos;\n"); } - WriteGuardBand(p); + if (PSP_CoreParameter().compat.flags().GuardBand) + WriteGuardBand(p); WRITE(p, " gl_Position = outPos;\n"); // TODO: Declare variables for dots for shade mapping if needed. diff --git a/GPU/Vulkan/VertexShaderGeneratorVulkan.cpp b/GPU/Vulkan/VertexShaderGeneratorVulkan.cpp index e7f7307681..efda658f88 100644 --- a/GPU/Vulkan/VertexShaderGeneratorVulkan.cpp +++ b/GPU/Vulkan/VertexShaderGeneratorVulkan.cpp @@ -28,6 +28,7 @@ #include "base/stringutil.h" #include "Common/Vulkan/VulkanLoader.h" #include "Core/Config.h" +#include "Core/System.h" #include "GPU/ge_constants.h" #include "GPU/GPUState.h" #include "GPU/Common/ShaderId.h" @@ -329,7 +330,8 @@ bool GenerateVulkanGLSLVertexShader(const ShaderID &id, char *buffer, bool *uses WRITE(p, " vec4 outPos = base.proj_mtx * vec4(position.xyz, 1.0);\n"); } } - WriteGuardBand(p); + if (PSP_CoreParameter().compat.flags().GuardBand) + WriteGuardBand(p); WRITE(p, " gl_Position = outPos;\n"); } else { // Step 1: World Transform / Skinning @@ -478,7 +480,8 @@ bool GenerateVulkanGLSLVertexShader(const ShaderID &id, char *buffer, bool *uses } else { WRITE(p, " vec4 outPos = base.proj_mtx * viewPos;\n"); } - WriteGuardBand(p); + if (PSP_CoreParameter().compat.flags().GuardBand) + WriteGuardBand(p); WRITE(p, " gl_Position = outPos;\n"); // TODO: Declare variables for dots for shade mapping if needed. diff --git a/assets/compat.ini b/assets/compat.ini index 9523aa7763..3026a75905 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -252,6 +252,24 @@ ULJS00201 = true # Bijin Tokei Portable not even a game, but needs it to load 2 miniatures, they will be low res, but better than black NPJH00055 = true +[GuardBand] +# Cull out of bounds triangles that were not clipped +# Sangokushi IX with Power-Up Kit +ULJM05842 = true +NPJH50546 = true +ULJM06156 = true +# Driver '76 +ULUS10235 = true +ULES00740 = true +# DTM Race Driver 2 / TOCA Race Driver 2: The Ultimate Racing Simulator / V8 Supercars 2 +ULES00041 = true +ULES00040 = true +ULKS46009 = true +ULJM05160 = true +ULES00042 = true +ULJM05363 = true +# might also be useful for Outrun and Brave Story? + [RequireBufferedRendering] # Warn the user that the game will not work and have issue, if buffered rendering is not enabled. # Midnight Club: LA Remix