[Bf-blender-cvs] [adc02910618] master: Fix T81633 Workbench: TAA never resolve when enabling both X-Ray and cavity

Clément Foucault noreply at git.blender.org
Wed Oct 14 19:27:03 CEST 2020


Commit: adc02910618c38c956c499e496278768ea0e041f
Author: Clément Foucault
Date:   Wed Oct 14 19:18:24 2020 +0200
Branches: master
https://developer.blender.org/rBadc02910618c38c956c499e496278768ea0e041f

Fix T81633 Workbench: TAA never resolve when enabling both X-Ray and cavity

This was caused by a wrong flag equality check when in xray mode because
the xray mode was masking the effect option flags that are not supported
in this mode. This means the never passed and the TAA was reset before
every redraw, leading to infinite rendering.

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

M	source/blender/draw/engines/workbench/workbench_data.c

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

diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index 310a8b861aa..c566b35cd34 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -179,14 +179,21 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
   }
 
   if (!v3d || (v3d->shading.type == OB_RENDER && BKE_scene_uses_blender_workbench(scene))) {
+    short shading_flag = scene->display.shading.flag;
+    if (XRAY_FLAG_ENABLED((&scene->display))) {
+      /* Disable shading options that aren't supported in transparency mode. */
+      shading_flag &= ~(V3D_SHADING_SHADOW | V3D_SHADING_CAVITY | V3D_SHADING_DEPTH_OF_FIELD);
+    }
+
     /* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
      * But this is a workaround for a missing update tagging from operators. */
-    if ((v3d && (XRAY_ENABLED(v3d) != XRAY_ENABLED(&scene->display))) ||
-        (scene->display.shading.flag != wpd->shading.flag)) {
+    if ((XRAY_ENABLED(wpd) != XRAY_ENABLED(&scene->display)) ||
+        (shading_flag != wpd->shading.flag)) {
       wpd->view_updated = true;
     }
 
     wpd->shading = scene->display.shading;
+    wpd->shading.flag = shading_flag;
     if (XRAY_FLAG_ENABLED((&scene->display))) {
       wpd->shading.xray_alpha = XRAY_ALPHA((&scene->display));
     }
@@ -206,13 +213,20 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
     }
   }
   else {
+    short shading_flag = v3d->shading.flag;
+    if (XRAY_ENABLED(v3d)) {
+      /* Disable shading options that aren't supported in transparency mode. */
+      shading_flag &= ~(V3D_SHADING_SHADOW | V3D_SHADING_CAVITY | V3D_SHADING_DEPTH_OF_FIELD);
+    }
+
     /* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
      * But this is a workaround for a missing update tagging from operators. */
-    if (XRAY_ENABLED(v3d) != XRAY_ENABLED(wpd) || v3d->shading.flag != wpd->shading.flag) {
+    if (XRAY_ENABLED(v3d) != XRAY_ENABLED(wpd) || shading_flag != wpd->shading.flag) {
       wpd->view_updated = true;
     }
 
     wpd->shading = v3d->shading;
+    wpd->shading.flag = shading_flag;
     if (wpd->shading.type < OB_SOLID) {
       wpd->shading.light = V3D_LIGHTING_FLAT;
       wpd->shading.color_type = V3D_SHADING_OBJECT_COLOR;
@@ -220,8 +234,6 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
     }
     else if (XRAY_ENABLED(v3d)) {
       wpd->shading.xray_alpha = XRAY_ALPHA(v3d);
-      /* Disable shading options that aren't supported in transparency mode. */
-      wpd->shading.flag &= ~(V3D_SHADING_SHADOW | V3D_SHADING_CAVITY | V3D_SHADING_DEPTH_OF_FIELD);
     }
     else {
       wpd->shading.xray_alpha = 1.0f;



More information about the Bf-blender-cvs mailing list