From 5a6c029814ff47f2b717cf85f3345e37d83962fb Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 30 Apr 2020 01:27:49 +1000 Subject: [PATCH] GPU: Disable dual-source blending on Mesa Gen7/Gen7.5 Apparently it's broken. Need to look into it more. --- src/core/gpu_hw_opengl.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index f2e546927..c900e5c25 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -154,9 +154,14 @@ std::tuple GPU_HW_OpenGL::ConvertToFramebufferCoordinates(s32 x, s32 y void GPU_HW_OpenGL::SetCapabilities(HostDisplay* host_display) { m_is_gles = (host_display->GetRenderAPI() == HostDisplay::RenderAPI::OpenGLES); + Log_InfoPrintf("Context Type: %s", m_is_gles ? "OpenGL" : "OpenGL ES"); - Log_InfoPrintf("GL_VERSION: %s", glGetString(GL_VERSION)); - Log_InfoPrintf("GL_RENDERER: %s", glGetString(GL_VERSION)); + const char* gl_vendor = reinterpret_cast(glGetString(GL_VENDOR)); + const char* gl_renderer = reinterpret_cast(glGetString(GL_RENDERER)); + const char* gl_version = reinterpret_cast(glGetString(GL_VERSION)); + Log_InfoPrintf("GL_VENDOR: %s", gl_vendor); + Log_InfoPrintf("GL_RENDERER: %s", gl_renderer); + Log_InfoPrintf("GL_VERSION: %s", gl_version); GLint max_texture_size = VRAM_WIDTH; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); @@ -185,6 +190,15 @@ void GPU_HW_OpenGL::SetCapabilities(HostDisplay* host_display) int max_dual_source_draw_buffers = 0; glGetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, &max_dual_source_draw_buffers); m_supports_dual_source_blend = (max_dual_source_draw_buffers > 0); + + // Dual-source blend currently has issues on Mesa for at least Gen7/Gen7.5. This needs more investigation, but just + // disable it for now. + if (std::strstr(gl_renderer, "Mesa DRI Intel(R) Haswell") || std::strstr(gl_renderer, "Mesa DRI Intel(R) Ivybridge")) + { + Log_WarningPrintf("Detected Mesa DRI broken dual-source blend, disabling."); + m_supports_dual_source_blend = false; + } + if (!m_supports_dual_source_blend) Log_WarningPrintf("Dual-source blending is not supported, this may break some mask effects.");