Page 1 of 1

[Bug] XnView generates wrong DDS header.

Posted: Mon Jul 26, 2010 1:17 pm
by Antonz
I'm working on a tool that handles 3D models and textures for our product. It uses NVTT (Nvidia Texture Tools) SDK for handling textures. Recently I received some DDS files generated by XNView that refuse to open in NVTT. After some investigation I have found that XNView writes wrong DDS header in them. More precisely it's invalid .dwSize field (first 4 bytes after 'magic' 'DDS ' FourCC). DirectX SDK states that this field should contain 124 for standard DDS file (or more for newer DX10 DDS file with extended header). In XNView generated files 24 written here. Therefore tools that validate DDS header fail to open such files.

Re: [Bug] XnView generates wrong DDS header.

Posted: Thu Sep 09, 2010 12:19 pm
by Antonz
Any updates on this? Confirmation or comments?

Re: [Bug] XnView generates wrong DDS header.

Posted: Tue Sep 14, 2010 12:42 pm
by Antonz
Also you're writing wrong dwFlags field (next field after size). DirectX documentation says:
dwFlags
Flags to indicate which members contain valid data.
DDSD_CAPS Required in every .dds file.
DDSD_HEIGHT Required in every .dds file.
DDSD_WIDTH Required in every .dds file.
DDSD_PITCH Required when pitch is provided for an uncompressed texture.
DDSD_PIXELFORMAT Required in every .dds file.
DDSD_MIPMAPCOUNT Required in a mipmapped texture.
DDSD_LINEARSIZE Required when pitch is provided for a compressed texture.
DDSD_DEPTH Required in a depth texture.
So, basically it must be at least: DDSD_CAPS (0x00000001l) | DDSD_HEIGHT (0x00000002l) | DDSD_WIDTH (0x00000004l) | DDSD_PIXELFORMAT (0x00001000l) =
0x00001007l - this is what Microsoft (and other) tools write here. You're writing only (0x00080000l), which means DDSD_LINEARSIZE .

Using last version - 1.97.7 .

Re: [Bug] XnView generates wrong DDS header.

Posted: Thu Mar 03, 2011 9:58 am
by xnview

Re: [Bug] XnView generates wrong DDS header.

Posted: Thu Mar 03, 2011 10:47 am
by Antonz
Well, it writes good dwFlags, but header size field is still wrong: 24 (0x00000018) instead of 124 (0x0000007C).

Re: [Bug] XnView generates wrong DDS header.

Posted: Thu Mar 03, 2011 10:57 am
by xnview
ok, i'll fix