[Bf-blender-cvs] [2c7efe5ac05] blender-v2.93-release: Fix T89405: Viewport Render Preview glitching (AMD)

Jeroen Bakker noreply at git.blender.org
Wed Jun 30 09:30:18 CEST 2021


Commit: 2c7efe5ac0557d5fb801eb7597d7a8d67dbadfcc
Author: Jeroen Bakker
Date:   Tue Jun 29 08:23:45 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB2c7efe5ac0557d5fb801eb7597d7a8d67dbadfcc

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.

===================================================================

M	source/blender/gpu/opengl/gl_backend.cc

===================================================================

diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc
index f31e0e05a44..e1814ec239a 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);
@@ -281,15 +292,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;
     }
   }



More information about the Bf-blender-cvs mailing list