From 7b72f873081091bc80728680cc924a2bc99a183a Mon Sep 17 00:00:00 2001 From: xebra Date: Sat, 25 Feb 2017 18:04:09 +0900 Subject: [PATCH] [spline/bezier]Add support for unsupported device about HW tess. --- GPU/D3D11/GPU_D3D11.cpp | 9 +++++++++ GPU/Directx9/GPU_DX9.cpp | 9 +++++++++ UI/GameSettingsScreen.cpp | 8 +++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index 41565c409c..6073a06eb6 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -41,6 +41,7 @@ #include "base/NativeApp.h" #include "base/logging.h" #include "profiler/profiler.h" +#include "i18n/i18n.h" #include "Core/Debugger/Breakpoints.h" #include "Core/MemMapHelpers.h" #include "Core/MIPS/MIPS.h" @@ -474,6 +475,14 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw) // Some of our defaults are different from hw defaults, let's assert them. // We restore each frame anyway, but here is convenient for tests. textureCache_->NotifyConfigChanged(); + + if (g_Config.bHardwareTessellation) { + // Disable hardware tessellation bacause DX11 is still unsupported. + 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_D3D11::~GPU_D3D11() { diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 602e91ea12..7f9e66cad4 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -22,6 +22,7 @@ #include "base/NativeApp.h" #include "base/logging.h" #include "profiler/profiler.h" +#include "i18n/i18n.h" #include "Core/Debugger/Breakpoints.h" #include "Core/MemMapHelpers.h" #include "Core/MIPS/MIPS.h" @@ -456,6 +457,14 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw) // We restore each frame anyway, but here is convenient for tests. dxstate.Restore(); textureCache_->NotifyConfigChanged(); + + if (g_Config.bHardwareTessellation) { + // Disable hardware tessellation bacause DX9 is still unsupported. + 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); + } } void GPU_DX9::UpdateCmdInfo() { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 5dfe5eeeb2..4a1e6edade 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -83,11 +83,15 @@ bool GameSettingsScreen::UseVerticalLayout() const { // This needs before run CheckGPUFeatures() // TODO: Remove this if fix the issue +<<<<<<< HEAD bool CheckSupportInstancedTessellation() { #if PPSSPP_PLATFORM(UWP) return true; #else // TODO: Make work with non-GL backends +======= +bool CheckSupportInstancedTessellationGLES() { +>>>>>>> 4a6e0c9... [spline/bezier]Add support for unsupported device about HW tess. int maxVertexTextureImageUnits; glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &maxVertexTextureImageUnits); bool vertexTexture = maxVertexTextureImageUnits >= 3; // At least 3 for hardware tessellation @@ -312,7 +316,9 @@ void GameSettingsScreen::CreateViews() { bezierChoiceDisable_ = g_Config.bSoftwareRendering || g_Config.bHardwareTessellation; return UI::EVENT_CONTINUE; }); - tessHWEnable_ = CheckSupportInstancedTessellation() && !g_Config.bSoftwareRendering && g_Config.bHardwareTransform; + bool isBackendSupportHWTess = g_Config.iGPUBackend == GPU_BACKEND_OPENGL || g_Config.iGPUBackend == GPU_BACKEND_VULKAN; + bool isDeviceSupportInstTess = g_Config.iGPUBackend == GPU_BACKEND_OPENGL ? CheckSupportInstancedTessellationGLES() : isBackendSupportHWTess; + tessHWEnable_ = isDeviceSupportInstTess && !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.