K
K
Kirill Nesmeyanov2021-12-15 18:18:14
OpenGL
Kirill Nesmeyanov, 2021-12-15 18:18:14

Is the DDS block size correct?

I'll gut the DDS format. All headers of any format are read correctly (in particular DXT1-5 and DX10, no proprietary ones).

After reading the headers, you need to correctly extract the Mip data. And here there is a suspicion that they are read not quite correctly.

For DXT1, the read data size is determined by the formula width * height * 8
For DXT3 and DXT5, the read data size is determined by the formula ((width + 3) >> 2) * ((height + 3) >> 2) * 16

Both algorithms (for DXT1-5) above correct and textures are successfully loaded into OpenGL and rendered.

And what to do with DX10? As far as I understand, this is just an extended version of data recording (with a specific compression algorithm and additional headers) and it would be more correct to compare not fourcc with the mip data size, but derive the algorithm based on the compression algorithm, right?

That is:
- For DXT1, say that DXGI_FORMAT_BC1_UNORM is used - For DXT3
, specify DXGI_FORMAT_BC3_UNORM -
For DXT5, specify DXGI_FORMAT_BC5_UNORM

And already, based on the compression algorithm DXGI_FORMAT_BC[X_XXXXX], derive the formula for determining mip: use ((width + 3) >> 2) * ((height+ 3) >> 2) * 16 Right?




PS I mapped like fourcc to DXGI formats (I took the logic from Microsoft's raw files), I haven't tested it yet, but somehow it looks like this https://github.com/SerafimArts/DirectDrawSurface/b...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question