diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 7ef0d2a1f4..8c960b29b1 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -17,6 +17,7 @@ #include "base/logging.h" #include "profiler/profiler.h" +#include "i18n/i18n.h" #include "Common/ChunkFile.h" #include "Common/GraphicsContext.h" @@ -471,6 +472,17 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw) shaderCachePath_ = GetSysDirectory(DIRECTORY_APP_CACHE) + "/" + g_paramSFO.GetValueString("DISC_ID") + ".glshadercache"; shaderManagerGL_->LoadAndPrecompile(shaderCachePath_); } + + if (g_Config.bHardwareTessellation) { + // Disable hardware tessellation if device is unsupported. + if (!gstate_c.Supports(GPU_SUPPORTS_INSTANCE_RENDERING | GPU_SUPPORTS_VERTEX_TEXTURE_FETCH | GPU_SUPPORTS_TEXTURE_FLOAT)) { + // TODO: Check unsupported device name list.(Above gpu features are supported but it has issues with weak gpu, memory, shader compiler etc...) + g_Config.bHardwareTessellation = false; + ERROR_LOG(G3D, "Hardware Tessellation is unsupported, falling back to software tessellation"); + I18NCategory *gr = GetI18NCategory("Graphics"); + host->NotifyUserMessage(gr->T("Turn off Hardware Tessellation - unsupported"), 2.5f, 0xFF3030FF); + } + } } GPU_GLES::~GPU_GLES() { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 2b5476c3b7..00a638d8c3 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -76,6 +76,18 @@ bool GameSettingsScreen::UseVerticalLayout() const { return dp_yres > dp_xres * 1.1f; } +// This needs before run CheckGPUFeatures() +// TODO: Remove this if fix the issue +bool CheckSupportInstancedTessellation() { + int maxVertexTextureImageUnits; + glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &maxVertexTextureImageUnits); + bool vertexTexture = maxVertexTextureImageUnits >= 3; // At least 3 for hardware tessellation + bool instanceRendering = gl_extensions.EXT_gpu_shader4; + bool textureFloat = gl_extensions.ARB_texture_float || gl_extensions.OES_texture_float; + + return instanceRendering && vertexTexture && textureFloat; +} + void GameSettingsScreen::CreateViews() { GameInfo *info = g_gameInfoCache->GetInfo(NULL, gamePath_, GAMEINFO_WANTBG | GAMEINFO_WANTSIZE); @@ -286,7 +298,8 @@ void GameSettingsScreen::CreateViews() { bezierChoiceDisable_ = g_Config.bSoftwareRendering || g_Config.bHardwareTessellation; return UI::EVENT_CONTINUE; }); - tessellationHW->SetEnabledPtr(&vtxCacheEnable_); // Same as Vertex Cache(!g_Config.bSoftwareRendering && g_Config.bHardwareTransform) + tessHWEnable_ = CheckSupportInstancedTessellation() && !g_Config.bSoftwareRendering && g_Config.bHardwareTransform; + tessellationHW->SetEnabledPtr(&tessHWEnable_); // In case we're going to add few other antialiasing option like MSAA in the future. // graphicsSettings->Add(new CheckBox(&g_Config.bFXAA, gr->T("FXAA"))); @@ -724,11 +737,13 @@ UI::EventReturn GameSettingsScreen::OnSoftwareRendering(UI::EventParams &e) { postProcEnable_ = !g_Config.bSoftwareRendering && (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); resolutionEnable_ = !g_Config.bSoftwareRendering && (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); bezierChoiceDisable_ = g_Config.bSoftwareRendering || g_Config.bHardwareTessellation; + tessHWEnable_ = CheckSupportInstancedTessellation() && !g_Config.bSoftwareRendering && g_Config.bHardwareTransform; return UI::EVENT_DONE; } UI::EventReturn GameSettingsScreen::OnHardwareTransform(UI::EventParams &e) { vtxCacheEnable_ = !g_Config.bSoftwareRendering && g_Config.bHardwareTransform; + tessHWEnable_ = CheckSupportInstancedTessellation() && !g_Config.bSoftwareRendering && g_Config.bHardwareTransform; return UI::EVENT_DONE; } diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 64ff85a100..f37e6284fe 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -117,6 +117,7 @@ private: bool resolutionEnable_; bool bloomHackEnable_; bool bezierChoiceDisable_; + bool tessHWEnable_; }; class SettingInfoMessage : public UI::TextView {