Geometric (OpenGL-less) picking
Redesign picking to avoid using OpenGL. Previously picking involved several GL operations per mouse movement, but now the GPU/GL isn't used at all.
By avoiding OpenGL and the graphics driver we also reduce CPU usage. Despite reimplementing the logic on the CPU, it still takes less CPU time than going through GL did.
This new approach also dramatically reduces the number of picking paint cycles required for cursor movement since the pickability of the entire screen is calculated and cached. The cache is only invalidated when the screen contents change so for typical desktop usage where the screen is mostly idle, cursor movement doesn't incur anywhere near as many paint cycles as it used to.
Performance before and after on an Intel i7-7700, tested with two different GPUs and drivers:
|Intel CPU||Intel GPU||Nvidia CPU||Nvidia GPU|
|Moving around a standard 125Hz mouse:|
|Moving around a window:|