[Bug] XnView generates wrong DDS header.

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: helmut, XnTriq, xnview

Post Reply
Antonz
Posts: 4
Joined: Mon Jul 26, 2010 1:00 pm

[Bug] XnView generates wrong DDS header.

Post 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.
Antonz
Posts: 4
Joined: Mon Jul 26, 2010 1:00 pm

Re: [Bug] XnView generates wrong DDS header.

Post by Antonz »

Any updates on this? Confirmation or comments?
Antonz
Posts: 4
Joined: Mon Jul 26, 2010 1:00 pm

Re: [Bug] XnView generates wrong DDS header.

Post 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 .
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: [Bug] XnView generates wrong DDS header.

Post by xnview »

Pierre.
Antonz
Posts: 4
Joined: Mon Jul 26, 2010 1:00 pm

Re: [Bug] XnView generates wrong DDS header.

Post by Antonz »

Well, it writes good dwFlags, but header size field is still wrong: 24 (0x00000018) instead of 124 (0x0000007C).
User avatar
xnview
Author of XnView
Posts: 46255
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: [Bug] XnView generates wrong DDS header.

Post by xnview »

ok, i'll fix
Pierre.
Post Reply