diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-06-29 09:23:45 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-06-29 10:04:24 +0300 |
commit | 2262d6c45adff2cca06dc0c7f758e8c2a0de74f2 (patch) | |
tree | 0534f0edb8fe9151cb8c20f3db740bada6adbe4b /source | |
parent | 28135c06bb5406feaea250d9aafeb7df51fa7cef (diff) |
Fix T89405: Viewport Render Preview glitching (AMD)
AMD Drivers didn't report an additional space in the rendered. This made
testing for the HQ workaround fail and the issue appeared back on
certain cards.
This fix will test with surrounding spaces or if the renderer name
endswith the given string. If any of these are the case the hq normals
workaround will be enabled.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/opengl/gl_backend.cc | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index d85f9f7684d..feda59b1639 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -38,6 +38,17 @@ namespace blender::gpu { /** \name Platform * \{ */ +static bool match_renderer(StringRef renderer, const Vector<std::string> &items) +{ + for (const std::string &item : items) { + const std::string wrapped = " " + item + " "; + if (renderer.endswith(item) || renderer.find(wrapped) != StringRef::not_found) { + return true; + } + } + return false; +} + void GLBackend::platform_init() { BLI_assert(!GPG.initialized); @@ -287,15 +298,26 @@ static void detect_workarounds() * `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to pack normals and flags. * The work around uses `GPU_RGBA16I`. */ - if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) { - if (strstr(renderer, " RX 460 ") || strstr(renderer, " RX 470 ") || - strstr(renderer, " RX 480 ") || strstr(renderer, " RX 490 ") || - strstr(renderer, " RX 560 ") || strstr(renderer, " RX 560X ") || - strstr(renderer, " RX 570 ") || strstr(renderer, " RX 580 ") || - strstr(renderer, " RX 580X ") || strstr(renderer, " RX 590 ") || - strstr(renderer, " RX550/550 ") || strstr(renderer, "(TM) 520 ") || - strstr(renderer, "(TM) 530 ") || strstr(renderer, "(TM) 535 ") || - strstr(renderer, " R5 ") || strstr(renderer, " R7 ") || strstr(renderer, " R9 ")) { + if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) { + const Vector<std::string> matches = {"RX 460", + "RX 470", + "RX 480", + "RX 490", + "RX 560", + "RX 560X", + "RX 570", + "RX 580", + "RX 580X", + "RX 590", + "RX550/550", + "(TM) 520", + "(TM) 530", + "(TM) 535", + "R5", + "R7", + "R9"}; + + if (match_renderer(renderer, matches)) { GCaps.use_hq_normals_workaround = true; } } |