{"record":{"id":"f90262223436aa1f","repo":"stride3d/stride","slug":"unexpected-arraysize-1-for-texture3d-from-dds-headerdx10","errorCode":null,"errorMessage":"Unexpected ArraySize > 1 for Texture3D from DDS HeaderDX10","messagePattern":"Unexpected ArraySize > 1 for Texture3D from DDS HeaderDX10","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Foundation/Graphics/DDSHelper.cs","lineNumber":372,"sourceCode":"                            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\n                if ((header.Flags & DDS.HeaderFlags.Volume) != 0)\n                {\n                    description.Width = header.Width;","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Foundation/Graphics/DDSHelper.cs#L354-L390","documentation":"3D (volume) textures cannot be part of a texture array. If the DX10 header declares ArraySize > 1 together with ResourceDimension == Texture3D, DecodeDDSHeader rejects the file, matching DirectXTex's validation rules.","triggerScenarios":"Loading a DDS with DX10 header where ResourceDimension is Texture3D and HeaderDXT10.ArraySize is greater than 1.","commonSituations":"Buggy exporters writing array counts for 3D textures, files converted from array textures to 3D without clearing ArraySize, corrupted files.","solutions":["Regenerate the DDS so 3D textures have ArraySize = 1","If an array is intended, export as Texture2D with array size instead","Patch ArraySize to 1 in the DX10 header if the data is genuinely a single volume"],"exampleFix":"// before (DX10 header)\nResourceDimension = Texture3D; ArraySize = 4\n// after\nResourceDimension = Texture3D; ArraySize = 1","handlingStrategy":"validation","validationCode":"// If DX10 ResourceDimension == Texture3D, require ArraySize == 1\nif (resourceDimension == 3 /*Texture3D*/) {\n    uint arraySize = BitConverter.ToUInt32(ddsBytes, 128 + 20);\n    if (arraySize > 1) throw new InvalidOperationException(\"DDS Texture3D cannot have ArraySize > 1\");\n}","typeGuard":null,"tryCatchPattern":"try { image = Image.Load(ddsBytes); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"ArraySize > 1 for Texture3D\")) { // regenerate as single volume or 2D array\n    throw new AssetLoadException(\"DDS volume texture declares an array; re-export\", ex); }","preventionTips":["Ensure exporters emit ArraySize = 1 for 3D textures","Use 2D texture arrays when array semantics are needed","Validate DX10 header fields in the asset import step","Pin to well-tested DDS tooling for volume textures"],"tags":["dds","textures","volume-texture","header-validation"],"backgroundTag":"invalid-argument-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"}