[Bf-blender-cvs] [22cf8b95325] blender-v2.83-release: Fix T91680: viewport selection broken in macOS x86 build with Xcode 13

Brecht Van Lommel noreply at git.blender.org
Wed Dec 8 15:45:42 CET 2021


Commit: 22cf8b9532568ee47ef1c6b7bd60bf9e8a50b508
Author: Brecht Van Lommel
Date:   Wed Dec 8 15:40:09 2021 +0100
Branches: blender-v2.83-release
https://developer.blender.org/rB22cf8b9532568ee47ef1c6b7bd60bf9e8a50b508

Fix T91680: viewport selection broken in macOS x86 build with Xcode 13

There is an apparent compiler bug here, tweak the code to avoid it. This did
not affect official builds as we were still using Xcode 12.

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

M	source/blender/editors/space_view3d/view3d_view.c

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

diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index b49d388019e..157c3682ee0 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -740,12 +740,12 @@ void view3d_winmatrix_set(Depsgraph *depsgraph,
                           const rcti *rect)
 {
   RegionView3D *rv3d = region->regiondata;
-  rctf viewplane;
+  rctf full_viewplane;
   float clipsta, clipend;
   bool is_ortho;
 
   is_ortho = ED_view3d_viewplane_get(
-      depsgraph, v3d, rv3d, region->winx, region->winy, &viewplane, &clipsta, &clipend, NULL);
+      depsgraph, v3d, rv3d, region->winx, region->winy, &full_viewplane, &clipsta, &clipend, NULL);
   rv3d->is_persp = !is_ortho;
 
 #if 0
@@ -753,21 +753,29 @@ void view3d_winmatrix_set(Depsgraph *depsgraph,
          __func__,
          winx,
          winy,
-         viewplane.xmin,
-         viewplane.ymin,
-         viewplane.xmax,
-         viewplane.ymax,
+         full_viewplane.xmin,
+         full_viewplane.ymin,
+         full_viewplane.xmax,
+         full_viewplane.ymax,
          clipsta,
          clipend);
 #endif
 
-  if (rect) { /* picking */
-    rctf r;
-    r.xmin = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmin / (float)region->winx));
-    r.ymin = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymin / (float)region->winy));
-    r.xmax = viewplane.xmin + (BLI_rctf_size_x(&viewplane) * (rect->xmax / (float)region->winx));
-    r.ymax = viewplane.ymin + (BLI_rctf_size_y(&viewplane) * (rect->ymax / (float)region->winy));
-    viewplane = r;
+  /* Note the code here was tweaked to avoid an apparent compiler bug in clang 13 (see T91680). */
+  rctf viewplane;
+  if (rect) {
+    /* Smaller viewplane subset for selection picking. */
+    viewplane.xmin = full_viewplane.xmin +
+                     (BLI_rctf_size_x(&full_viewplane) * (rect->xmin / (float)region->winx));
+    viewplane.ymin = full_viewplane.ymin +
+                     (BLI_rctf_size_y(&full_viewplane) * (rect->ymin / (float)region->winy));
+    viewplane.xmax = full_viewplane.xmin +
+                     (BLI_rctf_size_x(&full_viewplane) * (rect->xmax / (float)region->winx));
+    viewplane.ymax = full_viewplane.ymin +
+                     (BLI_rctf_size_y(&full_viewplane) * (rect->ymax / (float)region->winy));
+  }
+  else {
+    viewplane = full_viewplane;
   }
 
   if (is_ortho) {



More information about the Bf-blender-cvs mailing list