Skip to content

2D DDS textures with D3D10_RESOURCE_DIMENSION_UNKNOWN #667

@0xC0000054

Description

@0xC0000054

Related to 0xC0000054/pdn-ddsfiletype-plus#21

World of Tanks Blitz uses DDS_HEADER_DXT10 with the resourceDimension member set to D3D10_RESOURCE_DIMENSION_UNKNOWN instead of D3D10_RESOURCE_DIMENSION_TEXTURE2D.
These files can be read with NVTT, but DirectXTex treats them as invalid.

nvddsinfo.exe A05_M4_105BD_track_BC.dx11.dds
Flags: 0x000A1007
        DDSD_CAPS
        DDSD_PIXELFORMAT
        DDSD_WIDTH
        DDSD_HEIGHT
        DDSD_LINEARSIZE
        DDSD_MIPMAPCOUNT
Height: 256
Width: 256
Depth: 0
Linear size: 8192
Mipmap count: 9
Pixel Format:
        Flags: 0x00000004
                DDPF_FOURCC
        FourCC: 'DX10' (0x30315844)
        Bit count: 0
        Red mask:   0x00000000
        Green mask: 0x00000000
        Blue mask:  0x00000000
        Alpha mask: 0x00000000
Caps:
        Caps 1: 0x00401008
                DDSCAPS_COMPLEX
                DDSCAPS_TEXTURE
                DDSCAPS_MIPMAP
        Caps 2: 0x00000000
        Caps 3: 0x00000000
        Caps 4: 0x00000000
DX10 Header:
        DXGI Format: 78 (BC3_UNORM_SRGB)
        Resource dimension: 0 (UNKNOWN)
        Misc flag: 0
        Array size: 0

The most obvious fix would be something like the following above line 420 in DirectXTexDDS.cpp:

auto dimension = d3d10ext->resourceDimension;
if (flags & DDS_FLAGS_PERMISSIVE && dimension == DDS_DIMENSION_UNKNOWN)
{
    dimension = DDS_DIMENSION_TEXTURE2D;
}

switch (dimension)
{
case DDS_DIMENSION_TEXTURE1D:

But I am not sure if assuming that DDS_DIMENSION_UNKNOWN is always DDS_DIMENSION_TEXTURE2D would cause other issues.

Attaching the DDS file from the above nvddsinfo output: A05_M4_105BD_track_BC.zip

Metadata

Metadata

Assignees

Labels

ddsDirectDraw Surface (DDS)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions