[spline/bezier]Turn off Hardware Tessellation if device is unsupported.

This commit is contained in:
xebra 2017-01-31 23:29:13 +09:00
parent 159aa1415d
commit 6adddbbd38
3 changed files with 29 additions and 1 deletions

View file

@ -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() {

View file

@ -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;
}

View file

@ -117,6 +117,7 @@ private:
bool resolutionEnable_;
bool bloomHackEnable_;
bool bezierChoiceDisable_;
bool tessHWEnable_;
};
class SettingInfoMessage : public UI::TextView {