{"record":{"id":"78e8ae5875828def","repo":"stride3d/stride","slug":"texture3d-missing-headerflags-volume-from-dds-headerdx10","errorCode":null,"errorMessage":"Texture3D missing HeaderFlags.Volume from DDS HeaderDX10","messagePattern":"Texture3D missing HeaderFlags\\.Volume from DDS HeaderDX10","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Foundation/Graphics/DDSHelper.cs","lineNumber":369,"sourceCode":"                    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\n                        description.Width = header.Width;\n                        description.Height = header.Height;\n                        description.Depth = 1;\n                        break;\n\n                    case DDS.ResourceDimension.Texture3D:\n                        if ((header.Flags & DDS.HeaderFlags.Volume) == 0)\n                            throw new InvalidOperationException(\"Texture3D missing HeaderFlags.Volume from DDS HeaderDX10\");\n\n                        if (description.ArraySize > 1)\n                            throw new InvalidOperationException(\"Unexpected ArraySize > 1 for Texture3D from DDS HeaderDX10\");\n\n                        description.Width = header.Width;\n                        description.Height = header.Height;\n                        description.Depth = header.Depth;\n                        description.Dimension = TextureDimension.Texture3D;\n                        break;\n\n                    default:\n                        throw new InvalidOperationException(string.Format(\"Unexpected dimension [{0}] from DDS HeaderDX10\", headerDX10.ResourceDimension));\n                }\n            }\n            else\n            {\n                description.ArraySize = 1;\n","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Foundation/Graphics/DDSHelper.cs#L351-L387","documentation":"In the DDS layout, volume (3D) textures in the legacy header must set the HeaderFlags.Volume bit. When the DX10 header says Texture3D but the legacy header lacks that flag, the file contradicts itself and DecodeDDSHeader throws, following DirectXTex validation.","triggerScenarios":"Loading a DDS whose DX10 ResourceDimension is Texture3D while the DX9 header's dwFlags does not include DDS_HEADER_FLAGS_VOLUME (0x00800000).","commonSituations":"Files written by tools that set the DX10 dimension but not the legacy volume flag, hand-converted DDS files, corrupted downloads.","solutions":["Regenerate the 3D texture DDS with a proper tool (texconv/image tool)","Set the HeaderFlags.Volume bit in the file's DX9 header if hand-fixing","Convert to a single 2D slice if 3D data isn't actually needed"],"exampleFix":"// before (DX9 header dwFlags)\ndwFlags = HEIGHT|WIDTH|...            // missing VOLUME (0x00800000)\n// after\ndwFlags = HEIGHT|WIDTH|...|VOLUME     // 0x00800000 set","handlingStrategy":"validation","validationCode":"// If DX10 ResourceDimension == Texture3D, require legacy VOLUME flag (0x00800000)\nif (resourceDimension == 3 /*Texture3D*/) {\n    uint flags = BitConverter.ToUInt32(ddsBytes, 8);\n    if ((flags & 0x00800000) == 0) throw new InvalidOperationException(\"DDS Texture3D missing VOLUME flag in legacy header\");\n}","typeGuard":null,"tryCatchPattern":"try { image = Image.Load(ddsBytes); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"missing HeaderFlags.Volume\")) { // regenerate or patch file\n    throw new AssetLoadException(\"Malformed volume texture DDS; re-export with VOLUME flag\", ex); }","preventionTips":["Generate 3D texture DDS with tools that set the VOLUME flag","Validate volume textures at import time","Don't manually convert array/2D DDS files to 3D by editing headers","Store source volume data in a neutral format and convert in the pipeline"],"tags":["dds","textures","volume-texture","header-validation"],"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"}