[Bf-blender-cvs] [db45aaafab8] master: Fix T61474: laggy interaction on Windows/NVIDIA when gizmos are visible

Brecht Van Lommel noreply at git.blender.org
Tue Jul 9 14:04:04 CEST 2019


Commit: db45aaafab8cc821b0e06a659de44f5fedbf847b
Author: Brecht Van Lommel
Date:   Tue Jul 9 13:20:25 2019 +0200
Branches: master
https://developer.blender.org/rBdb45aaafab8cc821b0e06a659de44f5fedbf847b

Fix T61474: laggy interaction on Windows/NVIDIA when gizmos are visible

Thanks to Sergey and Clément for helping to track this down.

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

M	source/blender/gpu/intern/gpu_select_sample_query.c
M	source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c

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

diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c
index 9dc225b4190..beea25b4171 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.c
+++ b/source/blender/gpu/intern/gpu_select_sample_query.c
@@ -175,17 +175,8 @@ uint gpu_select_query_end(void)
 
   for (i = 0; i < g_query_state.active_query; i++) {
     uint result = 0;
-    /* Wait until the result is available. */
-    while (result == 0) {
-      glGetQueryObjectuiv(g_query_state.queries[i], GL_QUERY_RESULT_AVAILABLE, &result);
-      if (result == 0) {
-        /* (fclem) Not sure if this is better than calling glGetQueryObjectuiv() indefinitely.
-         * (brecht) Added debug test for lagging issue in T61474. */
-        if (G.debug_value != 474) {
-          PIL_sleep_ms(1);
-        }
-      }
-    }
+    /* We are not using GL_QUERY_RESULT_AVAILABLE and sleep to wait for results,
+     * because it causes lagging on Windows/NVIDIA, see T61474. */
     glGetQueryObjectuiv(g_query_state.queries[i], GL_QUERY_RESULT, &result);
     if (result > 0) {
       if (g_query_state.mode != GPU_SELECT_NEAREST_SECOND_PASS) {
diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
index 1c5fda2ec11..534474a6221 100644
--- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
+++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_map.c
@@ -552,6 +552,9 @@ static int gizmo_find_intersected_3d_intern(wmGizmo **visible_gizmos,
 
   bool use_select_bias = false;
 
+  /* TODO: waiting for the GPU in the middle of the event loop for every
+   * mouse move is bad for performance, we need to find a solution to not
+   * use the GPU or draw something once. (see T61474) */
   GPU_select_begin(buffer, ARRAY_SIZE(buffer), &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0);
   /* do the drawing */
   gizmo_draw_select_3d_loop(C, visible_gizmos, visible_gizmos_len, &use_select_bias);
@@ -644,7 +647,7 @@ static wmGizmo *gizmo_find_intersected_3d(bContext *C,
           break;
         }
       }
-      else {
+      else if (gz->type->draw_select != NULL) {
         has_3d = true;
       }
     }



More information about the Bf-blender-cvs mailing list