Add ugly hack setting for PowerVR to disable alpha test

Causes glitches but the speedup is truly massive in some games so I relent :/

Please do not report graphics bugs when this is enabled...

Future: Maybe remove this setting except on PowerVR?
This commit is contained in:
Henrik Rydgard 2013-10-22 13:00:19 +02:00
parent 7d8aed096a
commit bf59f3db73
7 changed files with 19 additions and 4 deletions

View file

@ -278,6 +278,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename)
IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
speedhacks->Get("PrescaleUV", &bPrescaleUV, false);
speedhacks->Get("DisableAlphaTest", &bDisableAlphaTest, false);
INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
bSaveSettings = true;
@ -467,6 +468,7 @@ void Config::Save() {
IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
speedhacks->Set("PrescaleUV", bPrescaleUV);
speedhacks->Set("DisableAlphaTest", bDisableAlphaTest);
if (!iniFile.Save(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", iniFilename_.c_str());

View file

@ -165,7 +165,7 @@ public:
// * Still has major problems so off by default - need to store tex scale/offset per DeferredDrawCall,
// which currently isn't done so if texscale/offset isn't static (like in Tekken 6) things go wrong.
bool bPrescaleUV;
bool bDisableAlphaTest; // Helps PowerVR immensely, breaks some graphics
// End GLES hacks.
// SystemParam

View file

@ -31,6 +31,7 @@
#include "gfx_es2/gl_state.h"
#include "Core/Reporting.h"
#include "Core/Config.h"
#include "GPU/GLES/FragmentShaderGenerator.h"
#include "GPU/GLES/Framebuffer.h"
#include "GPU/ge_constants.h"
@ -324,7 +325,7 @@ void GenerateFragmentShader(char *buffer) {
WRITE(p, " vec4 v = v_color0 %s;\n", secondary);
}
if (enableAlphaTest) {
if (enableAlphaTest && !g_Config.bDisableAlphaTest) {
GEComparison alphaTestFunc = gstate.getAlphaTestFunction();
const char *alphaTestFuncs[] = { "#", "#", " != ", " == ", " >= ", " > ", " <= ", " < " }; // never/always don't make sense
if (alphaTestFuncs[alphaTestFunc][0] != '#') {

View file

@ -1574,6 +1574,7 @@ void GLES_GPU::ClearCacheNextFrame() {
void GLES_GPU::Resized() {
framebufferManager_.Resized();
shaderManager_->ClearCache(true);
}
std::vector<FramebufferInfo> GLES_GPU::GetFramebufferList()

View file

@ -156,7 +156,9 @@ void GameSettingsScreen::CreateViews() {
static const char *texFilters[] = { "Auto", "Nearest", "Linear", "Linear on FMV", };
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gs->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), gs, screenManager()));
graphicsSettings->Add(new ItemHeader(gs->T("Hack Settings")));
graphicsSettings->Add(new ItemHeader(gs->T("Hack Settings", "Hack Settings (these WILL cause glitches)")));
// Maybe hide this on non-PVR?
graphicsSettings->Add(new CheckBox(&g_Config.bDisableAlphaTest, gs->T("Disable Alpha Test (PowerVR speedup)")))->OnClick.Handle(this, &GameSettingsScreen::OnShaderChange);
graphicsSettings->Add(new CheckBox(&g_Config.bDisableStencilTest, gs->T("Disable Stencil Test")));
graphicsSettings->Add(new CheckBox(&g_Config.bAlwaysDepthWrite, gs->T("Always Depth Write")));
CheckBox *prescale = graphicsSettings->Add(new CheckBox(&g_Config.bPrescaleUV, gs->T("Texture Coord Speedhack")));
@ -309,6 +311,13 @@ UI::EventReturn GameSettingsScreen::OnResolutionChange(UI::EventParams &e) {
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnShaderChange(UI::EventParams &e) {
if (gpu) {
gpu->Resized();
}
return UI::EVENT_DONE;
}
void DrawBackground(float alpha);
UI::EventReturn GameSettingsScreen::OnDumpNextFrameToLog(UI::EventParams &e) {

View file

@ -66,6 +66,7 @@ private:
UI::EventReturn OnRenderingMode(UI::EventParams &e);
UI::EventReturn OnFullscreenChange(UI::EventParams &e);
UI::EventReturn OnResolutionChange(UI::EventParams &e);
UI::EventReturn OnShaderChange(UI::EventParams &e);
UI::EventReturn OnRestoreDefaultSettings(UI::EventParams &e);
// Temporaries to convert bools to int settings

View file

@ -27,6 +27,7 @@ Vertex=fxaa.vsh
Name=Scanlines
Fragment=scanlines.fsh
Vertex=fxaa.vsh
OutputResolution=True
[Cartoon]
Name=Cartoon
Fragment=cartoon.fsh
@ -43,4 +44,4 @@ Vertex=aacolor.vsh
Name=Spline36 Upscaler
Fragment=upscale_spline36.fsh
Vertex=upscale_spline36.vsh
OutputResolution=True
OutputResolution=True