Skip to content

scene: Generate quads in the item-local coordinate space

Vlad Zahorodnii requested to merge work/scene-redesign-item-local-quads into master

Window quads need to be in some coordinate space. Since we want items to be used not only for rendering windows, window-local coordinates do not suffice.

This change makes scene items generate quads in the item-local coordinate space.

The model matrix is used to map the quads to the global screen coordinate system from the item coordinate space.

Since the quads are in the item local coordinate space, the mvp matrix needs to be updated on every draw call. Given the render data, tracking the last mvp matrix won't result in less glUniform calls. If this indeed becomes a serious performance bottleneck, we can explore the possibility of dumping mvp matrices in a UBO, which have been introduced in OpenGL 3.1.


At the moment, we handle window quads inefficiently. Window quads from all items are merged into a single list just to be broken up again.

This change removes window quads from libkwineffects. This allows us to handle window quads efficiently. Furthermore, we could optimize methods such as WindowVertex::left() and so on. KWin spends reasonable amount of time in those methods when many windows have to be composited.

It's a necessary prerequisite for making wl_surface painting code role agnostic.


The next steps will be: introduce an item layer machinery for cross-fade and other effects that need offscreen textures; move X11 explicit sync code out of SceneOpenGL to CompositorX11 and SurfaceItemX11; extract item rendering from scene and scene windows;

cc #30

Edited by Vlad Zahorodnii

Merge request reports