stride3d/stride · error · NotSupportedException
Texture Cubes must have an array size greater than 1
Error message
Texture Cubes must have an array size greater than 1
What it means
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.
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.
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 ArgumentException("TextureCube requires ArraySize >= 6 (6 per cube).", nameof(desc));
var tex = new Texture(device, desc); Type guard
static bool IsCubeSizeValid(TextureDescription d) => d.Dimension != TextureDimension.TextureCube || d.ArraySize >= 6;
Try / catch
try { tex = new Texture(device, desc); }
catch (NotSupportedException ex) when (ex.Message.Contains("Texture Cubes")) { desc.ArraySize = 6; tex = new Texture(device, desc); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Expecting a Texture supporting UAV
- Creating a texture from a SRV with dimension
- The options specified for the Texture are not valid.
- Multi-sampling is only supported for 2D Textures
- The destination array must be of same length or larger…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/4da55fb5c3fb0aea.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/Direct3D11/Texture.Direct3D11.cs:572
}
else // Not multi-sampled
{
switch (ViewDimension)
{
case TextureDimension.Texture1D:
srvDescription.ViewDimension = D3DSrvDimension.D3D101SrvDimensionTexture1D;
break;
case TextureDimension.Texture2D:
srvDescription.ViewDimension = D3DSrvDimension.D3D101SrvDimensionTexture2D;
break;
case TextureDimension.Texture3D:
srvDescription.ViewDimension = D3DSrvDimension.D3D101SrvDimensionTexture3D;
break;
case TextureDimension.TextureCube:
throw new NotSupportedException("Texture Cubes must have an array size greater than 1");
}
// Use srvDescription.Texture1D as it matches also Texture and Texture3D memory layout
srvDescription.Texture1D.MipLevels = (uint) mipCount;
srvDescription.Texture1D.MostDetailedMip = (uint) mipIndex;
}
}
ComPtr<ID3D11ShaderResourceView> srv = default;
HResult result = NativeDevice.CreateShaderResourceView(NativeResource, in srvDescription, ref srv);
if (result.IsFailure)
result.Throw();
return srv;
}
/// <summary>
/// Gets a specific <see cref="ID3D11RenderTargetView"/> from the Texture.View on GitHub (pinned to 96fad776d2)