[Bug] XnView generates wrong DDS header.
Moderators: helmut, XnTriq, xnview
[Bug] XnView generates wrong DDS header.
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.
Any updates on this? Confirmation or comments?
Re: [Bug] XnView generates wrong DDS header.
Also you're writing wrong dwFlags field (next field after size). DirectX documentation says:
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 .
So, basically it must be at least: DDSD_CAPS (0x00000001l) | DDSD_HEIGHT (0x00000002l) | DDSD_WIDTH (0x00000004l) | DDSD_PIXELFORMAT (0x00001000l) =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.
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.
Well, it writes good dwFlags, but header size field is still wrong: 24 (0x00000018) instead of 124 (0x0000007C).