[Bf-blender-cvs] [1fa27c4c505] blender-v2.91-release: GPU: Enable HQ normal work around for AMD Polaris

Jeroen Bakker noreply at git.blender.org
Wed Jan 13 14:31:16 CET 2021


Commit: 1fa27c4c5052c4a6051c3f1e264b880e1c225c18
Author: Jeroen Bakker
Date:   Mon Jan 4 12:15:51 2021 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rB1fa27c4c5052c4a6051c3f1e264b880e1c225c18

GPU: Enable HQ normal work around for AMD Polaris

THe high quality normals work around is enabled for Polaris cards using
the official drivers. Since driver version 2.11.2 they fail to render
using low quality normals.

The detection of polaris cards is done by matching the opengl renderer.
The renderer strings have been extracted from various reports linked to
{T82856} but isn't complete as some reports are missing the exact
renderer as users don't always report via the help menu.

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

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 46e048d7f7c..8371389d2fa 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -130,6 +130,13 @@ void GLBackend::platform_init(void)
         GPG.support_level = GPU_SUPPORT_LEVEL_LIMITED;
       }
     }
+    if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_ANY)) {
+      /* Platform seems to work when SB backend is disabled. This can be done
+       * by adding the environment variable `R600_DEBUG=nosb`. */
+      if (strstr(renderer, "AMD CEDAR")) {
+        GPG.support_level = GPU_SUPPORT_LEVEL_LIMITED;
+      }
+    }
   }
   GPG.create_key(GPG.support_level, vendor, renderer, version);
   GPG.create_gpu_name(vendor, renderer, version);
@@ -267,6 +274,23 @@ static void detect_workarounds(void)
     GCaps.shader_image_load_store_support = false;
     GCaps.broken_amd_driver = true;
   }
+  /* See T82856: AMD drivers since 20.11 running on a polaris architecture doesn't support the
+   * `GL_INT_2_10_10_10_REV` data type. This data type is used to pack normals. The work around
+   * uses `GPU_RGBA16I`.*/
+  if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) {
+    /* On Linux the driver does not report its version. Test the OpenGL version in stead. */
+	  if (strstr(version, "4.5.14756") || strstr(version, "4.5.14757")) {
+      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 590 ") || strstr(renderer, " RX550/550 ") ||
+          strstr(renderer, " (TM) 520  ") || strstr(renderer, " (TM) 530  ") ||
+          strstr(renderer, " R5 ") || strstr(renderer, " R7 ") || strstr(renderer, " R9 ")) {
+        GCaps.use_hq_normals_workaround = true;
+      }
+    }
+  }
   /* There is an issue with the #glBlitFramebuffer on MacOS with radeon pro graphics.
    * Blitting depth with#GL_DEPTH24_STENCIL8 is buggy so the workaround is to use
    * #GPU_DEPTH32F_STENCIL8. Then Blitting depth will work but blitting stencil will



More information about the Bf-blender-cvs mailing list