Commit: 86914e713347082aed8d77b663a02068c03b6313
Author: Clément Foucault
Date: Fri Apr 26 15:33:16 2019 +0200
Branches: master
https://developer.blender.org/rB86914e713347082aed8d77b663a02068c03b6313
GPUSelect: Don't read depth on every draw
If the draw uses the same id as the previous draw, there is no need to read the
depth
buffer at this point, avoiding a CPU-GPU sync bubble.
Fixes T62511 Selection is significantly slower in production scenes.
With this patch glReadPixels is not the bottleneck. Regular drawing Is still
very
slow so I would suggest fixing the regular drawing first before trying to
improve the selection algorithm.
===================================================================
M source/blender/gpu/intern/gpu_select_pick.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_select_pick.c
b/source/blender/gpu/intern/gpu_select_pick.c
index 6c3e05912b0..ffd4cd6efbc 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -479,7 +479,14 @@ static void gpu_select_load_id_pass_nearest(const
DepthBufCache *rect_prev,
bool gpu_select_pick_load_id(uint id)
{
GPUPickState *ps = &g_pick_state;
+
if (ps->gl.is_init) {
+ if (id == ps->gl.prev_id) {
+ /* No need to read if we are still drawing for the same id since
+ * all these depths will be merged / deduplicated in the end. */
+ return true;
+ }
+
const uint rect_len = ps->src.rect_len;
glReadPixels(UNPACK4(ps->gl.clip_readpixels),
GL_DEPTH_COMPONENT,
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs