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.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user