From e8269a9e364c04128bbec3b3f51302e908971c1e Mon Sep 17 00:00:00 2001 From: SachinVin Date: Wed, 6 Oct 2021 22:22:26 +0530 Subject: [PATCH] gl_format_reinterpreter.cpp: attempt to skip D24S8 to RGBA8 reinterpretation fast path for older nvidia GPUs, additionally check for GL_ARB_copy_image in the fallback path --- .../renderer_opengl/gl_format_reinterpreter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_format_reinterpreter.cpp b/src/video_core/renderer_opengl/gl_format_reinterpreter.cpp index ee842a8591..d6fc425a40 100644 --- a/src/video_core/renderer_opengl/gl_format_reinterpreter.cpp +++ b/src/video_core/renderer_opengl/gl_format_reinterpreter.cpp @@ -373,14 +373,19 @@ class CopyImageSubData final : public FormatReinterpreterBase { }; FormatReinterpreterOpenGL::FormatReinterpreterOpenGL() { - std::string_view vendor{reinterpret_cast(glGetString(GL_VENDOR))}; - if (vendor.find("NVIDIA") != vendor.npos) { + // Older Nvidia GPUs don't seem to properly support using glCopyImageSubData to copy D24S8 to + // RGBA8. This is a heuristic check that relies on the newer drivers returning something similar + // to `3.3.0 NVIDIA 471.41`, and older, buggy ones returning just `3.3.0`. + std::string_view version{reinterpret_cast(glGetString(GL_VERSION))}; + if (version.find("NVIDIA") != version.npos) { reinterpreters.emplace(PixelFormatPair{PixelFormat::RGBA8, PixelFormat::D24S8}, std::make_unique()); // Nvidia bends the spec and allows direct copies between color and depth formats // might as well take advantage of it LOG_INFO(Render_OpenGL, "Using glCopyImageSubData for D24S8 to RGBA8 reinterpretation"); - } else if ((GLAD_GL_ARB_stencil_texturing && GLAD_GL_ARB_texture_storage) || GLES) { + } else if ((GLAD_GL_ARB_stencil_texturing && GLAD_GL_ARB_texture_storage && + GLAD_GL_ARB_copy_image) || + GLES) { reinterpreters.emplace(PixelFormatPair{PixelFormat::RGBA8, PixelFormat::D24S8}, std::make_unique()); LOG_INFO(Render_OpenGL, "Using shader for D24S8 to RGBA8 reinterpretation");