{"record":{"id":"4da55fb5c3fb0aea","repo":"stride3d/stride","slug":"texture-cubes-must-have-an-array-size-greater-than-1","errorCode":null,"errorMessage":"Texture Cubes must have an array size greater than 1","messagePattern":"Texture Cubes must have an array size greater than 1","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs","lineNumber":572,"sourceCode":"                }\n                else // Not multi-sampled\n                {\n                    switch (ViewDimension)\n                    {\n                        case TextureDimension.Texture1D:\n                            srvDescription.ViewDimension = D3DSrvDimension.D3D101SrvDimensionTexture1D;\n                            break;\n\n                        case TextureDimension.Texture2D:\n                            srvDescription.ViewDimension = D3DSrvDimension.D3D101SrvDimensionTexture2D;\n                            break;\n\n                        case TextureDimension.Texture3D:\n                            srvDescription.ViewDimension = D3DSrvDimension.D3D101SrvDimensionTexture3D;\n                            break;\n\n                        case TextureDimension.TextureCube:\n                            throw new NotSupportedException(\"Texture Cubes must have an array size greater than 1\");\n                    }\n                    // Use srvDescription.Texture1D as it matches also Texture and Texture3D memory layout\n                    srvDescription.Texture1D.MipLevels = (uint) mipCount;\n                    srvDescription.Texture1D.MostDetailedMip = (uint) mipIndex;\n                }\n            }\n\n            ComPtr<ID3D11ShaderResourceView> srv = default;\n            HResult result = NativeDevice.CreateShaderResourceView(NativeResource, in srvDescription, ref srv);\n\n            if (result.IsFailure)\n                result.Throw();\n\n            return srv;\n        }\n\n        /// <summary>\n        ///   Gets a specific <see cref=\"ID3D11RenderTargetView\"/> from the Texture.","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs#L554-L590","documentation":"When creating a shader resource view of a TextureCube (or cube array) on D3D11, an array size of 0/1 or fewer than expected faces reaches the switch default and throws NotSupportedException: cube SRVs require a valid cube array size greater than 1 as enforced by the view-slice bounds logic.","triggerScenarios":"Creating a Texture with Dimension = TextureCube but ArraySize <= 1 (should be 6 per cube, 6*N for cube arrays), then rendering/binding it so InitializeFromImpl calls GetShaderResourceView.","commonSituations":"Description builders that treat cube textures like regular 2D arrays and leave ArraySize at 1; loading cubemaps where only one face was loaded and the array size was not set to 6; converter tools producing incomplete cubemap descriptions.","solutions":["Set ArraySize to 6 for a single TextureCube (or 6 * cubeCount for cube arrays).","Verify the asset import pipeline emits complete cubemaps with all six faces.","Add a pre-creation check: if Dimension == TextureCube, assert ArraySize >= 6."],"exampleFix":"// before\nvar desc = new TextureDescription { Dimension = TextureDimension.TextureCube, ArraySize = 1 };\n// after\nvar desc = new TextureDescription { Dimension = TextureDimension.TextureCube, ArraySize = 6 };","handlingStrategy":"validation","validationCode":"if (desc.Dimension == TextureDimension.TextureCube && desc.ArraySize < 6)\n    throw new ArgumentException(\"TextureCube requires ArraySize >= 6 (6 per cube).\", nameof(desc));\nvar tex = new Texture(device, desc);","typeGuard":"static bool IsCubeSizeValid(TextureDescription d) => d.Dimension != TextureDimension.TextureCube || d.ArraySize >= 6;","tryCatchPattern":"try { tex = new Texture(device, desc); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Texture Cubes\")) { desc.ArraySize = 6; tex = new Texture(device, desc); }","preventionTips":["Always set ArraySize = 6 for cube textures (6*N for cube arrays)","Verify cubemap loaders produce all six faces","Add a cube-size assert to your asset pipeline tests"],"tags":["direct3d11","texture","texture-cube","array-size"],"backgroundTag":"value-out-of-range","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"}