{"record":{"id":"5e26cfbfde6b0c52","repo":"stride3d/stride","slug":"invalid-format-from-dds-headerdx10","errorCode":null,"errorMessage":"Invalid Format from DDS HeaderDX10 ","messagePattern":"Invalid Format from DDS HeaderDX10 ","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Foundation/Graphics/DDSHelper.cs","lineNumber":335,"sourceCode":"                description.MipLevels = 1;\n\n            // Check for DX10 extension\n            if ((header.PixelFormat.Flags & DDS.PixelFormatFlags.FourCC) != 0 && (new FourCC('D', 'X', '1', '0') == header.PixelFormat.FourCC))\n            {\n                // Buffer must be big enough for both headers and magic value\n                if (size < (Unsafe.SizeOf<DDS.Header>() + sizeof (uint) + Unsafe.SizeOf<DDS.HeaderDXT10>()))\n                    return false;\n\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                        {","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Foundation/Graphics/DDSHelper.cs#L317-L353","documentation":"The DX10 header stores the texture format as a DXGI format. DecodeDDSHeader checks description.Format.IsValid after reading it; if the DXGIFormat enum value is not a known/valid format in this Stride build, parsing is aborted with this error, because no pixel format conversion mapping exists.","triggerScenarios":"Loading a DDS whose HeaderDXT10.DXGIFormat is an unknown/newer DXGI value (e.g. newer formats added in later DirectX SDKs) or an invalid value, on a Stride version whose PixelFormat mapping doesn't include it.","commonSituations":"DDS exported by very new tools using DXGI formats Stride doesn't know, hand-edited/corrupted headers, version drift between tooling and engine.","solutions":["Re-export the DDS with a widely supported DXGI format (e.g. BC1/BC3/BC7, R8G8B8A8)","Update Stride to a version that supports the newer DXGI format","Convert the texture to PNG/TGA then re-import through the engine pipeline","Verify the file with a DDS viewer to confirm the declared format"],"exampleFix":"// before (DDS DX10 header DXGIFormat)\nDXGIFormat = 95 // unknown to this Stride version\n// after\nDXGIFormat = 71 // DXGIFORMAT_BC1_UNORM","handlingStrategy":"validation","validationCode":"// Read DXGIFormat from DX10 header (offset 128+20+4) and compare against supported set\nvar dxgiFormat = BitConverter.ToUInt32(ddsBytes, 128 + 24);\nif (!Enum.IsDefined(typeof(PixelFormat), (int)dxgiFormat) /* or not in supported mapping */)\n    throw new NotSupportedException($\"DDS uses DXGI format {dxgiFormat} not supported by this engine build\");","typeGuard":null,"tryCatchPattern":"try { image = Image.Load(ddsBytes); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"Invalid Format from DDS HeaderDX10\")) { // re-export or convert texture\n    throw new AssetLoadException(\"Unsupported DDS DXGI format; re-export with BC1/BC3/BC7 or R8G8B8A8\", ex); }","preventionTips":["Export DDS using widely supported DXGI formats only","Keep engine and texture tooling versions aligned","Add asset validation that rejects exotic formats at import","Provide PNG/TGA fallbacks for source art"],"tags":["dds","textures","format","pixel-format"],"backgroundTag":"invalid-enum-value","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"}