2

I would like to load dds files into Qt 5.1 and have the benefit of saving memory and improve rendering performance as dds files in many cases are less in size (due to data destroying compression) than their png equivalent and also are stored in more cache friendly rendering structure "tiling" (i.e. http://fgiesen.wordpress.com/2011/01/17/texture-tiling-and-swizzling/) than usual raw image data is.

But... I can't find any reference about this topic when googling I only find others who read dds files and convert them into QImage which I suspect only unpacks the dds into a raw rgba only giving some extra performance when reading from disk but keeping all the bad parts like more memory, less efficient texel reading and now also compression artifacts for nothing.

Have I missunderstood how Qt is handling textures or can the dds formats dxt1-5 be utilized corretly within Qt 5.1?

Does the QImageReader "unpack" dds files to raw or actually loads them directly to graphics hardware as is?

Any other suggestions or pointers is very appreciated.

1 Answers1

2

QImage is a pure software object, it does not store anything on the graphics card and it has no support for exotic internal data ordering. The internal formats that QImage support are listed here: https://doc.qt.io/qt-5/qimage.html#Format-enum

So you basically have no other option of getting the data into a QImage than unpacking everything and flattening it out.

QPixmap supports reading from a file directly, see https://doc.qt.io/qt-5/qpixmap.html#load

Unlike QImage, QPixmap is an object that stores its data on the graphics card. It would be theoretically possible to do what you envision given the Qt interface. However my educated guess is that Qt still does not support this at all.

kefir500
  • 4,184
  • 6
  • 42
  • 48
ypnos
  • 50,202
  • 14
  • 95
  • 141