Skip to content

qt: introduce helper functions to create compressed OpenGL textures

Fatih Uzunoğlu requested to merge fuzun/vlc:qt-qml-tex-compression into master

There seems to be many advantages of using compressed textures. Qt 5.11 apparently brought changes to support more variety of them.

I wanted to explore the idea of using compressed textures for certain images in the interface. For example, content images that have to load in high resolution. Depending on the situation, it might make more sense to cache the images as KTX textures, rather than JPEGs, and load them directly.

Dealing with GPUs is not something I'm very familiar with, so you can leave any kind of feedback.

Advantages:

  • Reduction in VRAM usage.
  • No need to decode JPG/PNG/etc.
    • This does not mean much, as they are supposed to be loaded asynchronously in a separate thread.

Disadvantages:

  • Every compressed texture algorithm seem to be lossy.
  • According to my tests, Qt 5.11 does not seem to support smooth transformation of compressed textures.
  • Qt does not support KTX2 format and KTX1 does not have "super compression" feature. If I understood it correctly, it allows binary compression on the data. Because of lack of this feature, KTX1 files are often large.
  • Qt <6.0 has only experimental support for compressed atlas textures. This is important for reducing needed rendering batches.
    • Qt <6.0 only support ETC1/ETC2 compression for atlas textures (when QSG_ENABLE_COMPRESSED_ATLAS environment variable is set). This is probably useless here because desktop GPUs do not support this compression scheme natively, but they emulate it. I still tried it to see how it works, but it just did not work for me.
    • Qt 6.0 seems to have proper support: https://bugreports.qt.io/browse/QTBUG-78582.
Edited by Fatih Uzunoğlu

Merge request reports

Loading