Skip to content

Avoid converting images when updating GLTexture

Manuel Stoeckl requested to merge mstoeckl/kwin:direct-gl-updateloads into master

The change avoids a QImage::convertToFormat call when calling GLTexture::update with a QImage whose format is not ARGB32_Premultiplied.

A program which submits and updates buffers using a non-ARGB format is weston-presentation-shm. Running OpenGL programs with the environment variable LIBGL_ALWAYS_SOFTWARE=1 also sometimes works.

Misc notes:

  • Almost all Wayland clients right now send wl_shm buffers formatted as ARGB32_Premultiplied, so this is not yet a commonly used area of code.
  • The GL_UNPACK_* parameters are still only used for ARGB32_Premultiplied; other formats still incur an unnecessary image subrectangle copy much of the time.
  • There's a hack in SceneOpenGLShadow::prepareBackend() which uses QImage::Format_Indexed8 to emulate QImage::Format_Alpha8, which was not available pre Qt 5.5. This probably explains the weird image.colorCount() > 0 check
Edited by Manuel Stoeckl

Merge request reports

Loading