14c706e51b
Currently, Clutter does picking by drawing with Cogl and reading the pixel that's beneath the given point. Since Cogl has a journal that records drawing operations, and has optimizations to read a single pixel from a list of rectangle, it would be expected that we would hit this fast path and not flush the journal while picking. However, that's not the case: dithering, clipping with scissors, etc, can all flush the journal, issuing commands to the GPU and making picking slow. On NVidia-based systems, this glReadPixels() call is extremely costly. Introduce geometric picking, and avoid using the Cogl journal entirely. Do this by introducing a stack of actors in ClutterStage. This stack is cached, but for now, don't use the cache as much as possible. The picking routines are still tied to painting. When projecting the actor vertexes, do it manually and take the modelview matrix of the framebuffer into account as well. CPU usage on an Intel i7-7700, tested with two different GPUs/drivers: | | Intel | Nvidia | | ------: | --------: | -----: | | Moving the mouse: | | Before | 10% | 10% | | After | 6% | 6% | | Moving a window: | | Before | 23% | 81% | | After | 19% | 40% | Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154, https://gitlab.gnome.org/GNOME/mutter/issues/691 Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283, https://gitlab.gnome.org/GNOME/mutter/issues/590, https://gitlab.gnome.org/GNOME/mutter/issues/700 v2: Fix code style issues Simplify quadrilateral checks Remove the 0.5f hack Differentiate axis-aligned rectangles https://gitlab.gnome.org/GNOME/mutter/merge_requests/189 |
||
---|---|---|
.. | ||
clutter-actor-deprecated.c | ||
clutter-actor.h | ||
clutter-alpha.c | ||
clutter-alpha.h | ||
clutter-animatable.h | ||
clutter-animation.c | ||
clutter-animation.h | ||
clutter-behaviour-depth.c | ||
clutter-behaviour-depth.h | ||
clutter-behaviour-opacity.c | ||
clutter-behaviour-opacity.h | ||
clutter-behaviour-scale.c | ||
clutter-behaviour-scale.h | ||
clutter-behaviour.c | ||
clutter-behaviour.h | ||
clutter-bin-layout.h | ||
clutter-box.c | ||
clutter-box.h | ||
clutter-cairo-texture.c | ||
clutter-cairo-texture.h | ||
clutter-container.h | ||
clutter-group.c | ||
clutter-group.h | ||
clutter-keysyms.h | ||
clutter-layout-manager-deprecated.c | ||
clutter-rectangle.c | ||
clutter-rectangle.h | ||
clutter-stage-manager.h | ||
clutter-stage.h | ||
clutter-state.c | ||
clutter-state.h | ||
clutter-table-layout.c | ||
clutter-table-layout.h | ||
clutter-texture.c | ||
clutter-texture.h | ||
clutter-timeline.h |