Commit: 3adcfbf63c985f960c17080097ec998e6f90b6c4
Author: Jeroen Bakker
Date:   Fri Feb 4 14:07:06 2022 +0100
Branches: master
https://developer.blender.org/rB3adcfbf63c985f960c17080097ec998e6f90b6c4

Merge branch 'blender-v3.1-release'

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



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

diff --cc source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index ed38b4a154c,ab955a9e233..83e6e347ce7
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@@ -586,16 -586,24 +586,24 @@@ static int gizmo_find_intersected_3d_in
     * - #GPU_SELECT_PICK_ALL: Use for the same purpose as 
#GPU_SELECT_PICK_NEAREST
     *   when the selection depths need to re-ordered based on a bias.
     * */
 -  const int gpu_select_mode = (use_depth_test ?
 -                                   (has_3d_select_bias ?
 -                                         /* Using select bias means the 
depths need to be
 -                                          * re-calculated based on the bias 
to pick the best. */
 -                                         GPU_SELECT_PICK_ALL :
 -                                         /* No bias, just pick the closest. */
 -                                         GPU_SELECT_PICK_NEAREST) :
 -                                   /* Fast-path (occlusion queries). */
 -                                   GPU_SELECT_ALL);
 +  const eGPUSelectMode gpu_select_mode =
 +      (use_depth_test ? (has_3d_select_bias ?
 +                              /* Using select bias means the depths need to be
 +                               * re-calculated based on the bias to pick the 
best. */
 +                              GPU_SELECT_PICK_ALL :
 +                              /* No bias, just pick the closest. */
 +                              GPU_SELECT_PICK_NEAREST) :
 +                        /* Fast-path (occlusion queries). */
 +                        GPU_SELECT_ALL);
  
+   /* When switching between modes and the mouse pointer is over a gizmo, the 
highlight test is
+    * performed before the viewport is fully initialized (region->draw_buffer 
= NULL).
+    * When this is the case we should not use depth testing. */
+   GPUViewport *gpu_viewport = WM_draw_region_get_viewport(region);
+   if (use_depth_test && gpu_viewport == NULL) {
+     return -1;
+   }
+ 
    if (GPU_select_is_cached()) {
      GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, gpu_select_mode, 0);
      GPU_select_cache_load_id();

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to