Merge pull request #3686 from Armada651/revert-3578

Revert "Merge pull request #3578 from Armada651/forced-slow-depth"
This commit is contained in:
Pierre Bourdon 2016-03-03 02:03:03 +01:00
commit 265c6408d6
23 changed files with 56 additions and 30 deletions

View File

@ -17,3 +17,7 @@ EmulationIssues =
[ActionReplay]
# Add action replay cheats here.
[Video_Settings]
FastDepthCalc = False

View File

@ -7,7 +7,7 @@ FPRF = True
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4
EmulationIssues =
EmulationIssues = Shadows need fast depth enabled.
[OnLoad]
# Add memory patches to be loaded once on boot here.
@ -17,3 +17,6 @@ EmulationIssues =
[ActionReplay]
# Add action replay cheats here.
[Video_Settings]
FastDepthCalc = True

View File

@ -5,7 +5,7 @@
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationIssues = Needs real xfb for the videos to display.
EmulationIssues = Needs real xfb for the videos to display. Shadow issues with fastdepth (D3D).
EmulationStateId = 4
[OnLoad]
@ -20,3 +20,4 @@ EmulationStateId = 4
[Video_Settings]
UseXFB = True
UseRealXFB = True
FastDepthCalc = False

View File

@ -5,7 +5,7 @@
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationIssues = Needs real xfb for the videos to display.
EmulationIssues = Needs real xfb for the videos to display. Shadow issues with fastdepth (D3D).
EmulationStateId = 4
[OnLoad]
@ -20,3 +20,4 @@ EmulationStateId = 4
[Video_Settings]
UseXFB = True
UseRealXFB = True
FastDepthCalc = False

View File

@ -5,7 +5,7 @@
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationIssues = Needs real xfb for the videos to display.
EmulationIssues = Needs real xfb for the videos to display. Shadow issues with fastdepth (D3D).
EmulationStateId = 4
[OnLoad]
@ -20,3 +20,4 @@ EmulationStateId = 4
[Video_Settings]
UseXFB = True
UseRealXFB = True
FastDepthCalc = False

View File

@ -21,5 +21,8 @@ EmulationIssues =
EFBAccessEnable = True
EFBToTextureEnable = False
[Video_Settings]
FastDepthCalc = False
[Video_Stereoscopy]
StereoConvergence = 115

View File

@ -17,6 +17,9 @@ EmulationIssues =
[ActionReplay]
# Add action replay cheats here.
[Video_Settings]
FastDepthCalc = True
[Video_Hacks]
EFBToTextureEnable = False

View File

@ -21,4 +21,4 @@ EmulationIssues =
[Video_Settings]
SafeTextureCacheColorSamples = 512
ForcedSlowDepth = True
FastDepthCalc = False

View File

@ -18,4 +18,4 @@ EmulationIssues =
# Add action replay cheats here.
[Video_Settings]
ForcedSlowDepth = True
FastDepthCalc = False

View File

@ -19,4 +19,5 @@ EmulationStateId = 4
[Video_Settings]
SafeTextureCacheColorSamples = 512
FastDepthCalc = False

View File

@ -18,7 +18,7 @@ EmulationIssues = Sound crackling can be fixed by lle audio.
# Add action replay cheats here.
[Video_Settings]
ForcedSlowDepth = True
FastDepthCalc = False
SafeTextureCacheColorSamples = 512
[Video_Stereoscopy]

View File

@ -6,7 +6,7 @@
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4
EmulationIssues = Needs real wiimote and motion plus.
EmulationIssues = Needs real wiimote and motion plus. Time stone transition needs Fast Depth off.
[OnLoad]
# Add memory patches to be loaded once on boot here.
@ -18,3 +18,6 @@ EmulationIssues = Needs real wiimote and motion plus.
[Video_Hacks]
EFBAccessEnable = True
EFBEmulateFormatChanges = True
[Video_Settings]
FastDepthCalc = False

View File

@ -5,7 +5,7 @@
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationIssues =
EmulationIssues = Glitches in the game menu with fast depth enabled.
EmulationStateId = 4
[OnLoad]
@ -16,3 +16,6 @@ EmulationStateId = 4
[ActionReplay]
# Add action replay cheats here.
[Video_Settings]
FastDepthCalc = False

View File

@ -263,6 +263,7 @@ public final class SettingsFragmentPresenter
Setting efbToTexture = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_EFB_TEXTURE);
Setting texCacheAccuracy = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_TEXCACHE_ACCURACY);
IntSetting xfb = new IntSetting(SettingsFile.KEY_XFB, SettingsFile.SECTION_GFX_HACKS, xfbValue);
Setting fastDepth = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_FAST_DEPTH);
Setting aspectRatio = mSettings.get(SettingsFile.SECTION_GFX_HACKS).getSetting(SettingsFile.KEY_ASPECT_RATIO);
sl.add(new HeaderSetting(null, null, R.string.embedded_frame_buffer, 0));
@ -277,6 +278,7 @@ public final class SettingsFragmentPresenter
sl.add(new SingleChoiceSetting(SettingsFile.KEY_XFB_METHOD, SettingsFile.SECTION_GFX_HACKS, R.string.external_frame_buffer, R.string.external_frame_buffer_descrip, R.array.externalFrameBufferEntries, R.array.externalFrameBufferValues, 0, xfb));
sl.add(new HeaderSetting(null, null, R.string.other, 0));
sl.add(new CheckBoxSetting(SettingsFile.KEY_FAST_DEPTH, SettingsFile.SECTION_GFX_HACKS, R.string.fast_depth_calculation, R.string.fast_depth_calculation_descrip, true, fastDepth));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_ASPECT_RATIO, SettingsFile.SECTION_GFX_HACKS, R.string.aspect_ratio, R.string.aspect_ratio_descrip, R.array.aspectRatioEntries, R.array.aspectRatioValues, 0, aspectRatio));
}

View File

@ -72,6 +72,7 @@ public final class SettingsFile
public static final String KEY_TEXCACHE_ACCURACY = "SafeTextureCacheColorSamples";
public static final String KEY_XFB = "UseXFB";
public static final String KEY_XFB_REAL = "UseRealXFB";
public static final String KEY_FAST_DEPTH = "FastDepthCalc";
public static final String KEY_ASPECT_RATIO = "AspectRatio";
public static final String KEY_GCPAD_TYPE = "SIDevice";

View File

@ -195,6 +195,8 @@
<string name="external_frame_buffer_real">実機</string>
<string name="disable_destination_alpha">Disable Destination Alpha</string>
<string name="disable_destination_alpha_descrip">多くのタイトルで画面効果に使用されている、アルファ透過処理をスキップ 。</string>
<string name="fast_depth_calculation">高速奥行き計算</string>
<string name="fast_depth_calculation_descrip">深度値を計算するために精度の低いアルゴリズムを使用します。</string>
<!-- Miscellaneous -->
<string name="yes">はい</string>

View File

@ -315,6 +315,8 @@
<string name="external_frame_buffer_real">Real</string>
<string name="disable_destination_alpha">Disable Destination Alpha</string>
<string name="disable_destination_alpha_descrip">Disables emulation of a hardware feature called destination alpha, which is used in many games for various effects.</string>
<string name="fast_depth_calculation">Fast Depth Calculation</string>
<string name="fast_depth_calculation_descrip">Uses a less accurate algorithm to calculate depth values.</string>
<string name="aspect_ratio">Aspect Ratio</string>
<string name="aspect_ratio_descrip">Select what aspect ratio to use when rendering</string>

View File

@ -108,6 +108,7 @@ static wxString af_desc = wxTRANSLATE("Enable anisotropic filtering.\nEnhances v
static wxString aa_desc = wxTRANSLATE("Reduces the amount of aliasing caused by rasterizing 3D graphics. This smooths out jagged edges on objects.\nIncreases GPU load and sometimes causes graphical issues. SSAA is significantly more demanding than MSAA, but provides top quality geometry anti-aliasing and also applies anti-aliasing to lighting, shader effects, and textures.\n\nIf unsure, select None.");
static wxString scaled_efb_copy_desc = wxTRANSLATE("Greatly increases quality of textures generated using render-to-texture effects.\nRaising the internal resolution will improve the effect of this setting.\nSlightly increases GPU load and causes relatively few graphical issues.\n\nIf unsure, leave this checked.");
static wxString pixel_lighting_desc = wxTRANSLATE("Calculates lighting of 3D objects per-pixel rather than per-vertex, smoothing out the appearance of lit polygons and making individual triangles less noticeable.\nRarely causes slowdowns or graphical issues.\n\nIf unsure, leave this unchecked.");
static wxString fast_depth_calc_desc = wxTRANSLATE("Use a less accurate algorithm to calculate depth values.\nCauses issues in a few games, but can give a decent speedup depending on the game and/or your GPU.\n\nIf unsure, leave this checked.");
static wxString disable_bbox_desc = wxTRANSLATE("Disable the bounding box emulation.\nThis may improve the GPU performance a lot, but some games will break.\n\nIf unsure, leave this checked.");
static wxString force_filtering_desc = wxTRANSLATE("Filter all textures, including any that the game explicitly set as unfiltered.\nMay improve quality of certain textures in some games, but will cause issues in others.\nOn Direct3D, setting Anisotropic Filtering above 1x will also have the same effect as enabling this option.\n\nIf unsure, leave this unchecked.");
static wxString borderless_fullscreen_desc = wxTRANSLATE("Implement fullscreen mode with a borderless window spanning the whole screen instead of using exclusive mode.\nAllows for faster transitions between fullscreen and windowed mode, but slightly increases input latency, makes movement less smooth and slightly decreases performance.\nExclusive mode is required for Nvidia 3D Vision to work in the Direct3D backend.\n\nIf unsure, leave this unchecked.");
@ -516,6 +517,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
// - other hacks
{
wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5);
szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"), wxGetTranslation(fast_depth_calc_desc), vconfig.bFastDepthCalc));
szr_other->Add(CreateCheckBox(page_hacks, _("Disable Bounding Box"), wxGetTranslation(disable_bbox_desc), vconfig.bBBoxEnable, true));
wxStaticBoxSizer* const group_other = new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("Other"));

View File

@ -285,14 +285,13 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
GenerateVSOutputMembers<T>(out, ApiType);
out.Write("};\n");
const bool forced_slow_depth = g_ActiveConfig.bForcedSlowDepth || !g_ActiveConfig.backend_info.bSupportsClipControl;
const bool forced_early_z = g_ActiveConfig.backend_info.bSupportsEarlyZ && bpmem.UseEarlyDepthTest()
&& (!forced_slow_depth || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED)
&& (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED)
// We can't allow early_ztest for zfreeze because depth is overridden per-pixel.
// This means it's impossible for zcomploc to be emulated on a zfrozen polygon.
&& !(bpmem.zmode.testenable && bpmem.genMode.zfreeze);
const bool per_pixel_depth = (bpmem.ztex2.op != ZTEXTURE_DISABLE && bpmem.UseLateDepthTest())
|| (forced_slow_depth && bpmem.zmode.testenable && !forced_early_z)
|| (!g_ActiveConfig.bFastDepthCalc && bpmem.zmode.testenable && !forced_early_z)
|| (bpmem.zmode.testenable && bpmem.genMode.zfreeze);
if (forced_early_z)
@ -325,7 +324,7 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
// D3D11 also has a way to force the driver to enable early-z, so we're fine here.
if(ApiType == API_OPENGL)
{
// This is a #define which signals whatever early-z method the driver supports.
// This is a #define which signals whatever early-z method the driver supports.
out.Write("FORCE_EARLY_Z; \n");
}
else
@ -333,7 +332,7 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
out.Write("[earlydepthstencil]\n");
}
}
else if (bpmem.UseEarlyDepthTest() && (!forced_slow_depth || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED))
else if (bpmem.UseEarlyDepthTest() && (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED))
{
static bool warn_once = true;
if (warn_once)
@ -562,13 +561,11 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
out.Write("\tint zCoord = int(" I_ZSLOPE".z + " I_ZSLOPE".x * screenpos.x + " I_ZSLOPE".y * screenpos.y);\n");
}
else if (forced_slow_depth)
else if (!g_ActiveConfig.bFastDepthCalc)
{
// Due to floating point round-trip issues some depth equations are not as accurate as required.
// Depth equations used in D3D and OGL with GL_ARB_clip_control are accurate, but older cards
// that do not support GL_ARB_clip_control are not accurate enough under OGL. So on these older
// cards we just calculate the depth value again.
// FastDepth means to trust the depth generated in perspective division.
// It should be correct, but it seems not to be as accurate as required. TODO: Find out why!
// For disabled FastDepth we just calculate the depth value again.
// The performance impact of this additional calculation doesn't matter, but it prevents
// the host GPU driver from performing any early depth test optimizations.
out.SetConstantsUsed(C_ZBIAS+1, C_ZBIAS+1);
@ -577,7 +574,6 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
}
else
{
// Our D3D backend uses inverse depth values, so we invert them to the expected value here.
if (ApiType == API_D3D)
out.Write("\tint zCoord = int((1.0 - rawpos.z) * 16777216.0);\n");
else
@ -591,7 +587,7 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
uid_data->ztex_op = bpmem.ztex2.op;
uid_data->per_pixel_depth = per_pixel_depth;
uid_data->forced_early_z = forced_early_z;
uid_data->forced_slow_depth = forced_slow_depth;
uid_data->fast_depth_calc = g_ActiveConfig.bFastDepthCalc;
uid_data->early_ztest = bpmem.UseEarlyDepthTest();
uid_data->fog_fsel = bpmem.fog.c_proj_fsel.fsel;
uid_data->zfreeze = bpmem.genMode.zfreeze;
@ -599,7 +595,6 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
// Note: z-textures are not written to depth buffer if early depth test is used
if (per_pixel_depth && bpmem.UseEarlyDepthTest())
{
// Our D3D backend uses inverse depth values, so we invert them back to the depth buffer value here.
if (ApiType == API_D3D)
out.Write("\tdepth = 1.0 - float(zCoord) / 16777216.0;\n");
else
@ -619,7 +614,6 @@ static T GeneratePixelShader(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType)
if (per_pixel_depth && bpmem.UseLateDepthTest())
{
// Our D3D backend uses inverse depth values, so we invert them back to the depth buffer value here.
if (ApiType == API_D3D)
out.Write("\tdepth = 1.0 - float(zCoord) / 16777216.0;\n");
else

View File

@ -42,7 +42,7 @@ struct pixel_shader_uid_data
u32 fog_fsel : 3;
u32 fog_RangeBaseEnabled : 1;
u32 ztex_op : 2;
u32 forced_slow_depth : 1;
u32 fast_depth_calc : 1;
u32 per_pixel_depth : 1;
u32 forced_early_z : 1;
u32 early_ztest : 1;

View File

@ -333,7 +333,7 @@ static T GenerateVertexShader(API_TYPE api_type)
else // OGL
{
// this results in a scale from -1..0 to -1..1 after perspective
// divide, but introduces a floating point round-trip error.
// divide
out.Write("o.pos.z = o.pos.z * -2.0 - o.pos.w;\n");
// the next steps of the OGL pipeline are:

View File

@ -71,7 +71,7 @@ void VideoConfig::Load(const std::string& ini_file)
settings->Get("FreeLook", &bFreeLook, 0);
settings->Get("UseFFV1", &bUseFFV1, 0);
settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0);
settings->Get("ForcedSlowDepth", &bForcedSlowDepth, false);
settings->Get("FastDepthCalc", &bFastDepthCalc, true);
settings->Get("MSAA", &iMultisamples, 1);
settings->Get("SSAA", &bSSAA, false);
settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native
@ -165,7 +165,7 @@ void VideoConfig::GameIniLoad()
CHECK_SETTING("Video_Settings", "ConvertHiresTextures", bConvertHiresTextures);
CHECK_SETTING("Video_Settings", "CacheHiresTextures", bCacheHiresTextures);
CHECK_SETTING("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
CHECK_SETTING("Video_Settings", "ForcedSlowDepth", bForcedSlowDepth);
CHECK_SETTING("Video_Settings", "FastDepthCalc", bFastDepthCalc);
CHECK_SETTING("Video_Settings", "MSAA", iMultisamples);
CHECK_SETTING("Video_Settings", "SSAA", bSSAA);
@ -282,7 +282,7 @@ void VideoConfig::Save(const std::string& ini_file)
settings->Set("FreeLook", bFreeLook);
settings->Set("UseFFV1", bUseFFV1);
settings->Set("EnablePixelLighting", bEnablePixelLighting);
settings->Set("ForcedSlowDepth", bForcedSlowDepth);
settings->Set("FastDepthCalc", bFastDepthCalc);
settings->Set("MSAA", iMultisamples);
settings->Set("SSAA", bSSAA);
settings->Set("EFBScale", iEFBScale);

View File

@ -117,7 +117,7 @@ struct VideoConfig final
std::string sPhackvalue[2];
float fAspectRatioHackW, fAspectRatioHackH;
bool bEnablePixelLighting;
bool bForcedSlowDepth;
bool bFastDepthCalc;
int iLog; // CONF_ bits
int iSaveTargetId; // TODO: Should be dropped