From d468814a6d981a5c00290fe7316c4490edefad12 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 10 Nov 2020 20:55:35 +1000 Subject: [PATCH] GPU: Disable texture filters when dual-source blend is unsupported --- src/core/gpu_hw.cpp | 13 ++++++++++++- src/core/gpu_hw.h | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 0e6c152d1..5996a0fa5 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -55,7 +55,6 @@ bool GPU_HW::Initialize(HostDisplay* host_display) m_texture_filtering = g_settings.gpu_texture_filter; m_using_uv_limits = ShouldUseUVLimits(); m_chroma_smoothing = g_settings.gpu_24bit_chroma_smoothing; - PrintSettingsToLog(); if (m_multisamples != g_settings.gpu_multisamples) { @@ -68,7 +67,15 @@ bool GPU_HW::Initialize(HostDisplay* host_display) g_host_interface->AddOSDMessage( g_host_interface->TranslateStdString("OSDMessage", "SSAA is not supported, using MSAA instead."), 20.0f); } + if (!m_supports_dual_source_blend && TextureFilterRequiresDualSourceBlend(m_texture_filtering)) + { + g_host_interface->AddFormattedOSDMessage( + 20.0f, g_host_interface->TranslateString("OSDMessage", "Texture filter '%s' is not supported on your device."), + Settings::GetTextureFilterDisplayName(m_texture_filtering)); + m_texture_filtering = GPUTextureFilter::Nearest; + } + PrintSettingsToLog(); return true; } @@ -150,6 +157,10 @@ void GPU_HW::UpdateHWSettings(bool* framebuffer_changed, bool* shaders_changed) m_texture_filtering = g_settings.gpu_texture_filter; m_using_uv_limits = use_uv_limits; m_chroma_smoothing = g_settings.gpu_24bit_chroma_smoothing; + + if (!m_supports_dual_source_blend && TextureFilterRequiresDualSourceBlend(m_texture_filtering)) + m_texture_filtering = GPUTextureFilter::Nearest; + PrintSettingsToLog(); } diff --git a/src/core/gpu_hw.h b/src/core/gpu_hw.h index 10d2694f6..31c16a2be 100644 --- a/src/core/gpu_hw.h +++ b/src/core/gpu_hw.h @@ -225,6 +225,13 @@ protected: } } + /// Returns true if the specified texture filtering mode requires dual-source blending. + ALWAYS_INLINE bool TextureFilterRequiresDualSourceBlend(GPUTextureFilter filter) + { + return (filter == GPUTextureFilter::Bilinear || filter == GPUTextureFilter::JINC2 || + filter == GPUTextureFilter::xBR); + } + /// Returns true if alpha blending should be enabled for drawing the current batch. ALWAYS_INLINE bool UseAlphaBlending(TransparencyMode transparency_mode, BatchRenderMode render_mode) const {