{"record":{"id":"c9ecf67a9b5056e1","repo":"stride3d/stride","slug":"a-texture-cube-must-have-an-arraysize-1","errorCode":null,"errorMessage":"A Texture Cube must have an ArraySize > 1","messagePattern":"A Texture Cube must have an ArraySize > 1","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs","lineNumber":646,"sourceCode":"                    }\n                    else // Non-multisampled Texture\n                    {\n                        switch (Dimension)\n                        {\n                            case TextureDimension.Texture1D:\n                                srvDescription.ViewDimension = SrvDimension.Texture1D;\n                                break;\n\n                            case TextureDimension.Texture2D:\n                                srvDescription.ViewDimension = SrvDimension.Texture2D;\n                                break;\n\n                            case TextureDimension.Texture3D:\n                                srvDescription.ViewDimension = SrvDimension.Texture3D;\n                                break;\n\n                            case TextureDimension.TextureCube:\n                                throw new NotSupportedException(\"A Texture Cube must have an ArraySize > 1\");\n                        }\n                        // Use srvDescription.Texture1D as it matches also Texture2D and Texture3D memory layout\n                        srvDescription.Texture1D.MipLevels = (uint) mipCount;\n                        srvDescription.Texture1D.MostDetailedMip = (uint) mipIndex;\n                    }\n                }\n\n                var descriptorHandle = GraphicsDevice.ShaderResourceViewAllocator.Allocate(1);\n\n                NativeDevice.CreateShaderResourceView(NativeResource, in srvDescription, descriptorHandle);\n                return descriptorHandle;\n            }\n\n            //\n            // Gets a specific Render Target View from the Texture.\n            //\n            CpuDescriptorHandle GetRenderTargetView(ViewType viewType, int arrayOrDepthSlice, int mipIndex)\n            {","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs#L628-L664","documentation":"A D3D12 shader-resource view for texture cubes requires TextureCube or TextureCubeArray view dimensions; this code path builds the single-cube layout only when ArraySize > 1 (i.e. a cube array). A TextureCube dimension with ArraySize <= 1 on this path cannot be represented, so the backend throws NotSupportedException.","triggerScenarios":"Creating/initializing an SRV slice where Dimension == TextureCube but the texture's ArraySize is 1 (or 0/negative) in the branch expecting a cube array.","commonSituations":"Loading a single cubemap through the cube-array code path (mip-slice view creation); texture description computed with a wrong arrayCount instead of 6.","solutions":["Set ArraySize to 6 (or a multiple of 6) for cube textures","Use the standard non-sliced cube view path for a single cubemap","Fix the texture description so cube textures always declare their 6 faces"],"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) throw new InvalidOperationException(\"TextureCube requires ArraySize of 6 (or a multiple of 6)\");","typeGuard":"bool IsValidCubeDescription(TextureDescription d) => d.Dimension != TextureDimension.TextureCube || (d.ArraySize >= 6 && d.ArraySize % 6 == 0);","tryCatchPattern":"try { texture = new Texture(device, desc); } catch (NotSupportedException) { /* fix ArraySize for cube textures */ throw; }","preventionTips":["Always declare ArraySize = 6 for cubemaps","Use dedicated cubemap factory helpers instead of hand-built TextureDescriptions"],"tags":["direct3d12","texture","cubemap"],"backgroundTag":"invalid-config-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"}