Remove the depth range hack option, turning it into an ugly game specific compatibility hack.

I hate doing this, but it's not really better off as an option.

See #8171
This commit is contained in:
Henrik Rydgard 2015-11-05 22:02:06 +01:00
parent 3acdd4e237
commit 4b360a571c
12 changed files with 46 additions and 9 deletions

View File

@ -42,4 +42,5 @@ void Compatibility::Clear() {
void Compatibility::LoadIniSection(IniFile &iniFile, std::string section) {
iniFile.Get(section.c_str(), "NoDepthRounding", &flags_.NoDepthRounding, flags_.NoDepthRounding);
iniFile.Get(section.c_str(), "PixelDepthRounding", &flags_.PixelDepthRounding, flags_.PixelDepthRounding);
iniFile.Get(section.c_str(), "DepthRangeHack", &flags_.DepthRangeHack, flags_.DepthRangeHack);
}

View File

@ -47,6 +47,7 @@
struct CompatFlags {
bool NoDepthRounding;
bool PixelDepthRounding;
bool DepthRangeHack;
};
class IniFile;

View File

@ -461,7 +461,6 @@ static ConfigSetting graphicsSettings[] = {
ConfigSetting("VSyncInterval", &g_Config.bVSync, false, true, true),
ReportedConfigSetting("DisableStencilTest", &g_Config.bDisableStencilTest, false, true, true),
ReportedConfigSetting("AlwaysDepthWrite", &g_Config.bAlwaysDepthWrite, false, true, true),
ReportedConfigSetting("DepthRangeHack", &g_Config.bDepthRangeHack, false, true, true),
ReportedConfigSetting("BloomHack", &g_Config.iBloomHack, 0, true, true),
// Not really a graphics setting...

View File

@ -187,7 +187,6 @@ public:
int iCwCheatRefreshRate;
bool bDisableStencilTest;
bool bAlwaysDepthWrite;
bool bDepthRangeHack;
int iBloomHack; //0 = off, 1 = safe, 2 = balanced, 3 = aggressive
bool bTimerHack;
bool bAlphaMaskHack;

View File

@ -467,13 +467,23 @@ void DIRECTX9_GPU::UpdateCmdInfo() {
cmdInfo_[GE_CMD_VERTEXTYPE].func = &DIRECTX9_GPU::Execute_VertexType;
}
CheckGPUFeatures();
}
void DIRECTX9_GPU::CheckGPUFeatures() {
u32 features = 0;
features |= GPU_SUPPORTS_BLEND_MINMAX;
features |= GPU_SUPPORTS_TEXTURE_LOD_CONTROL;
if (!PSP_CoreParameter().compat.flags().NoDepthRounding)
if (!PSP_CoreParameter().compat.flags().NoDepthRounding) {
features |= GPU_ROUND_DEPTH_TO_16BIT;
}
// The Phantasy Star hack :(
if (PSP_CoreParameter().compat.flags().DepthRangeHack) {
features |= GPU_USE_DEPTH_RANGE_HACK;
}
gstate_c.featureFlags = features;
}

View File

@ -37,6 +37,7 @@ class DIRECTX9_GPU : public GPUCommon {
public:
DIRECTX9_GPU();
~DIRECTX9_GPU();
void CheckGPUFeatures();
void InitClear() override;
void PreExecuteOp(u32 op, u32 diff) override;
void ExecuteOp(u32 op, u32 diff) override;

View File

@ -344,7 +344,7 @@ void ShaderManagerDX9::VSUpdateUniforms(int dirtyUniforms) {
// In Phantasy Star Portable 2, depth range sometimes goes negative and is clamped by glDepthRange to 0,
// causing graphics clipping glitch (issue #1788). This hack modifies the projection matrix to work around it.
if (g_Config.bDepthRangeHack) {
if (gstate_c.Supports(GPU_USE_DEPTH_RANGE_HACK)) {
float zScale = gstate.getViewportZScale() / 65535.0f;
float zCenter = gstate.getViewportZCenter() / 65535.0f;

View File

@ -557,6 +557,11 @@ void GLES_GPU::CheckGPUFeatures() {
}
}
// The Phantasy Star hack :(
if (PSP_CoreParameter().compat.flags().DepthRangeHack) {
features |= GPU_USE_DEPTH_RANGE_HACK;
}
#ifdef MOBILE_DEVICE
// Arguably, we should turn off GPU_IS_MOBILE on like modern Tegras, etc.
features |= GPU_IS_MOBILE;

View File

@ -432,7 +432,7 @@ void LinkedShader::UpdateUniforms(u32 vertType) {
// In Phantasy Star Portable 2, depth range sometimes goes negative and is clamped by glDepthRange to 0,
// causing graphics clipping glitch (issue #1788). This hack modifies the projection matrix to work around it.
if (g_Config.bDepthRangeHack) {
if (gstate_c.Supports(GPU_USE_DEPTH_RANGE_HACK)) {
float zScale = gstate.getViewportZScale() / 65535.0f;
float zCenter = gstate.getViewportZCenter() / 65535.0f;

View File

@ -453,6 +453,7 @@ enum {
GPU_SUPPORTS_UNPACK_SUBIMAGE = FLAG_BIT(3),
GPU_SUPPORTS_BLEND_MINMAX = FLAG_BIT(4),
GPU_SUPPORTS_LOGIC_OP = FLAG_BIT(5),
GPU_USE_DEPTH_RANGE_HACK = FLAG_BIT(6),
GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH = FLAG_BIT(20),
GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT = FLAG_BIT(22),
GPU_ROUND_DEPTH_TO_16BIT = FLAG_BIT(23), // Can be disabled either per game or if we use a real 16-bit depth buffer

View File

@ -312,9 +312,6 @@ void GameSettingsScreen::CreateViews() {
CheckBox *prescale = graphicsSettings->Add(new CheckBox(&g_Config.bPrescaleUV, gr->T("Texture Coord Speedhack")));
prescale->SetDisabledPtr(&g_Config.bSoftwareRendering);
CheckBox *depthRange = graphicsSettings->Add(new CheckBox(&g_Config.bDepthRangeHack, gr->T("Depth Range Hack (Phantasy Star Portable 2)")));
depthRange->SetDisabledPtr(&g_Config.bSoftwareRendering);
static const char *bloomHackOptions[] = { "Off", "Safe", "Balanced", "Aggressive" };
PopupMultiChoice *bloomHack = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iBloomHack, gr->T("Lower resolution for effects (reduces artifacts)"), bloomHackOptions, 0, ARRAY_SIZE(bloomHackOptions), gr->GetName(), screenManager()));
bloomHackEnable_ = !g_Config.bSoftwareRendering && (g_Config.iInternalResolution != 1);

View File

@ -108,7 +108,30 @@ PixelDepthRounding = true
PixelDepthRounding = true
[ULJS00454]
PixelDepthRounding = true
# Heroes Phantasia Limited Edition Disc requires pixel depth rounding.
[ULJS00455]
PixelDepthRounding = true
# Phantasy Star Portable has a strange depth clipping issue that we have been unable to solve other ways.
[ULJM05309]
DepthRangeHack = true
[ULUS10410]
DepthRangeHack = true
[ULES01218]
DepthRangeHack = true
[ULJM08023]
DepthRangeHack = true
[ULES01218]
DepthRangeHack = true
# Phantasy Star Portable 2 has the same issue.
[ULJM05493]
DepthRangeHack = true
[NPJH50043]
DepthRangeHack = true
[ULJM08030]
DepthRangeHack = true
[NPJH50043]
DepthRangeHack = true
[ULES01439]
DepthRangeHack = true