diff options
author | Campbell Barton <campbell@blender.org> | 2022-01-26 09:10:37 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-01-26 09:24:21 +0300 |
commit | 0cb5eae9d0617abedf745753c23061ddfcfd1416 (patch) | |
tree | 46b2ad52af77c2c793ff4d61a02ead693541d198 /source/blender/gpu | |
parent | 1758dcd42316448fec7609263ec32a26d8bc0673 (diff) |
Gizmo: optimize intersection tests, fix selection bias
Use more efficient logic for detecting when gizmos are under the cursor.
Even though this isn't a bottleneck, it runs on cursor motion in the
3D viewport, so avoiding any lag here is beneficial.
The common case for cursor motion without any gizmos was always
drawing two passes (one small, then again if nothing was found).
Now a single draw call at the larger size is used.
In isolation this gives around 1.2x-1.4x speedup.
When there are multiple gizmos a depth-buffer picking is used
(similar to object / bone selection) which is more involved but
still only performs 2x draw calls since the result is cached for reuse.
See note in gizmo_find_intersected_3d for a more detailed explanation.
Also restore the depth values in the selection result as they're
needed for gizmos to use selection bias.
Broken since support for GL_SELECT was removed.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_select_pick.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c index 737e4c6e874..ddd3dfc6879 100644 --- a/source/blender/gpu/intern/gpu_select_pick.c +++ b/source/blender/gpu/intern/gpu_select_pick.c @@ -673,7 +673,7 @@ uint gpu_select_pick_end(void) #endif /* first 3 are dummy values */ g_pick_state.buffer[hits][0] = 1; - g_pick_state.buffer[hits][1] = 0x0; /* depth_data[i].depth; */ /* unused */ + g_pick_state.buffer[hits][1] = depth_data[i].depth; g_pick_state.buffer[hits][2] = 0x0; /* z-far is currently never used. */ g_pick_state.buffer[hits][3] = depth_data[i].id; hits++; |