{"record":{"id":"658e5436d5c94396","repo":"stride3d/stride","slug":"unexpected-height-1-from-dds-headerdx10","errorCode":null,"errorMessage":"Unexpected Height != 1 from DDS HeaderDX10 ","messagePattern":"Unexpected Height != 1 from DDS HeaderDX10 ","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Foundation/Graphics/DDSHelper.cs","lineNumber":343,"sourceCode":"\n                var headerDX10 = *(DDS.HeaderDXT10*) ((byte*) headerPtr + sizeof (int) + Unsafe.SizeOf<DDS.Header>());\n                convFlags |= ConversionFlags.DX10;\n\n                description.ArraySize = headerDX10.ArraySize;\n                if (description.ArraySize == 0)\n                    throw new InvalidOperationException(\"Unexpected ArraySize == 0 from DDS HeaderDX10 \");\n\n                description.Format = headerDX10.DXGIFormat;\n                if (!description.Format.IsValid)\n                    throw new InvalidOperationException(\"Invalid Format from DDS HeaderDX10 \");\n\n                switch (headerDX10.ResourceDimension)\n                {\n                    case DDS.ResourceDimension.Texture1D:\n\n                        // D3DX writes 1D textures with a fixed Height of 1\n                        if ((header.Flags & DDS.HeaderFlags.Height) != 0 && header.Height != 1)\n                            throw new InvalidOperationException(\"Unexpected Height != 1 from DDS HeaderDX10 \");\n\n                        description.Width = header.Width;\n                        description.Height = 1;\n                        description.Depth = 1;\n                        description.Dimension = TextureDimension.Texture1D;\n                        break;\n\n                    case DDS.ResourceDimension.Texture2D:\n                        if ((headerDX10.MiscFlags & DDS.ResourceOptionFlags.TextureCube) != 0)\n                        {\n                            description.ArraySize *= 6;\n                            description.Dimension = TextureDimension.TextureCube;\n                        }\n                        else\n                        {\n                            description.Dimension = TextureDimension.Texture2D;\n                        }\n","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Foundation/Graphics/DDSHelper.cs#L325-L361","documentation":"Per the DDS/DirectXTex convention, 1D textures always have height 1. When the DX10 header declares ResourceDimension == Texture1D but the legacy DDS header carries a Height flag with a value other than 1, the file is internally inconsistent, so DecodeDDSHeader throws.","triggerScenarios":"Loading a DDS with DX10 extension where ResourceDimension is Texture1D but the DX9 header has DDS_HEADER_FLAGS_HEIGHT set and height != 1 — usually from a malformed writer or manual edit.","commonSituations":"Custom exporters that write 1D texture dimensions incorrectly, files converted between dimensions by hand-edited headers, corrupted files.","solutions":["Re-export the texture as a proper 1D or 2D texture with a standard tool","If it is actually a 2D texture, fix ResourceDimension in the DX10 header to Texture2D","If truly 1D, set the header height to 1 and clear the Height flag if your writer allows"],"exampleFix":"// before (DDS header)\nResourceDimension = Texture1D; Height = 64\n// after\nResourceDimension = Texture1D; Height = 1","handlingStrategy":"validation","validationCode":"// If DX10 ResourceDimension == Texture1D, verify legacy header height == 1\nif (resourceDimension == 1 /*Texture1D*/) {\n    uint height = BitConverter.ToUInt32(ddsBytes, 12);\n    bool hasHeightFlag = (BitConverter.ToUInt32(ddsBytes, 8) & 0x2 /*HEIGHT*/) != 0;\n    if (hasHeightFlag && height != 1) throw new InvalidOperationException(\"DDS declares Texture1D but height != 1\");\n}","typeGuard":null,"tryCatchPattern":"try { image = Image.Load(ddsBytes); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"Unexpected Height != 1\")) { // regenerate asset as proper 1D/2D texture\n    throw new AssetLoadException(\"Malformed 1D texture DDS; re-export\", ex); }","preventionTips":["Avoid hand-editing DDS headers","Use texconv or similar for 1D texture exports","Validate dimension fields during asset import","Keep source art in PNG/TGA and generate DDS in the pipeline"],"tags":["dds","textures","header-validation","file-format"],"backgroundTag":"schema-validation-failed","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}