stride3d/stride · error · NotSupportedException
A Texture Cube must have an ArraySize > 1
Error message
A Texture Cube must have an ArraySize > 1
What it means
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.
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
Example fix
// before
var desc = new TextureDescription { Dimension = TextureDimension.TextureCube, ArraySize = 1, ... };
// after
var desc = new TextureDescription { Dimension = TextureDimension.TextureCube, ArraySize = 6, ... }; Defensive patterns
Strategy: validation
Validate before calling
if (desc.Dimension == TextureDimension.TextureCube && desc.ArraySize < 6) throw new InvalidOperationException("TextureCube requires ArraySize of 6 (or a multiple of 6)"); Type guard
bool IsValidCubeDescription(TextureDescription d) => d.Dimension != TextureDimension.TextureCube || (d.ArraySize >= 6 && d.ArraySize % 6 == 0);
Try / catch
try { texture = new Texture(device, desc); } catch (NotSupportedException) { /* fix ArraySize for cube textures */ throw; } Prevention
- Always declare ArraySize = 6 for cubemaps
- Use dedicated cubemap factory helpers instead of hand-built TextureDescriptions
When it happens
Trigger: 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.
Common situations: Loading a single cubemap through the cube-array code path (mip-slice view creation); texture description computed with a wrong arrayCount instead of 6.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Expecting texture supporting UAV
- Source Texture is not a MSAA Texture
- The Graphics Resource is a Texture, but its dimension is…
- Multisample is only supported for 2D Textures
- Multisample is only supported for 2D Render Target Textures
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/c9ecf67a9b5056e1.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D12/Texture.Direct3D12.cs:646
}
else // Non-multisampled Texture
{
switch (Dimension)
{
case TextureDimension.Texture1D:
srvDescription.ViewDimension = SrvDimension.Texture1D;
break;
case TextureDimension.Texture2D:
srvDescription.ViewDimension = SrvDimension.Texture2D;
break;
case TextureDimension.Texture3D:
srvDescription.ViewDimension = SrvDimension.Texture3D;
break;
case TextureDimension.TextureCube:
throw new NotSupportedException("A Texture Cube must have an ArraySize > 1");
}
// Use srvDescription.Texture1D as it matches also Texture2D and Texture3D memory layout
srvDescription.Texture1D.MipLevels = (uint) mipCount;
srvDescription.Texture1D.MostDetailedMip = (uint) mipIndex;
}
}
var descriptorHandle = GraphicsDevice.ShaderResourceViewAllocator.Allocate(1);
NativeDevice.CreateShaderResourceView(NativeResource, in srvDescription, descriptorHandle);
return descriptorHandle;
}
//
// Gets a specific Render Target View from the Texture.
//
CpuDescriptorHandle GetRenderTargetView(ViewType viewType, int arrayOrDepthSlice, int mipIndex)
{View on GitHub (pinned to 96fad776d2)