stride3d/stride · error · InvalidOperationException
Cannot generate more than 65535 indices on feature level HW…
Error message
Cannot generate more than 65535 indices on feature level HW <= 9.3
What it means
When a geometric primitive needs 32-bit indices (more than 65535 vertices/indices) the underlying feature level must support them. On GraphicsProfile.Level_9_3 or lower hardware, 32-bit index buffers are unavailable, so constructing such a primitive throws. This protects against creating index buffers the GPU cannot consume.
Solutions
- Reduce primitive tessellation (fewer segments/subdivisions) so index count stays at or below 65535.
- Require a higher GraphicsProfile: request Level_10_0 or above when creating the GraphicsDevice.
- Check graphicsDevice.Features.CurrentProfile at startup and fall back to lower-detail meshes on Level_9_3 devices.
- Split the mesh into multiple primitives each under 65535 indices.
Example fix
// before
var sphere = new GeometricPrimitive(GraphicsDevice, SphereProceduralModel.Default { Tessellation = 256 });
// after
var tessellation = GraphicsDevice.Features.CurrentProfile <= GraphicsProfile.Level_9_3 ? 32 : 128;
var sphere = new GeometricPrimitive(GraphicsDevice, SphereProceduralModel.Default { Tessellation = tessellation }); Defensive patterns
Strategy: validation
Validate before calling
if (indices.Length > 65535 &&
graphicsDevice.Features.CurrentProfile <= GraphicsProfile.Level_9_3)
throw new NotSupportedException("32-bit indices unsupported at this profile"); Type guard
bool Supports32BitIndices(GraphicsDevice d) => d.Features.CurrentProfile > GraphicsProfile.Level_9_3;
Try / catch
try { return new GeometricPrimitive(device, model); }
catch (InvalidOperationException) { return BuildLowDetailPrimitive(device); } Prevention
- Check Features.CurrentProfile before building high-tessellation meshes
- Cap tessellation parameters at UI/asset level
- Design LOD fallbacks for Level_9_3 devices
When it happens
Trigger: Creating a GeometricPrimitive (e.g. GeometricPrimitive.Sphere/Plane with high tessellation) whose index count exceeds 65535 while graphicsDevice.Features.CurrentProfile <= GraphicsProfile.Level_9_3.
Common situations: Targeting low-end hardware, old GPUs, or software renderers limited to DirectX feature level 9.x; requesting very high tessellation/segment counts on primitives; running on devices (e.g. old mobile GPUs) where the app fell back to Level_9_3.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Binding describes an array larger than dataOuter
- Binding describes an array larger than dataOuter
- Control points apply only to PrimitiveType.PatchList
- destination length does not match the amount of indices…
- destination length does not match the amount of vertices…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/3eca4e0065fe3186.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Graphics/GeometricPrimitives/GeometricPrimitive.cs:96
var indices = geometryMesh.Indices;
if (geometryMesh.IsLeftHanded)
ReverseWinding(vertices, indices);
if (indices.Length < 0xFFFF)
{
var indicesShort = new ushort[indices.Length];
for (int i = 0; i < indicesShort.Length; i++)
{
indicesShort[i] = (ushort)indices[i];
}
IndexBuffer = Buffer.Index.New(graphicsDevice, indicesShort).RecreateWith(indicesShort).DisposeBy(this);
}
else
{
if (graphicsDevice.Features.CurrentProfile <= GraphicsProfile.Level_9_3)
{
throw new InvalidOperationException("Cannot generate more than 65535 indices on feature level HW <= 9.3");
}
IndexBuffer = Buffer.Index.New(graphicsDevice, indices).RecreateWith(indices).DisposeBy(this);
IsIndex32Bits = true;
}
// For now it will keep buffers for recreation.
// TODO: A better alternative would be to store recreation parameters so that we can reuse procedural code.
VertexBuffer = Buffer.Vertex.New(graphicsDevice, vertices).RecreateWith(vertices).DisposeBy(this);
VertexBufferBinding = new VertexBufferBinding(VertexBuffer, new T().GetLayout(), vertices.Length);
PipelineState.State.SetDefaults();
PipelineState.State.InputElements = VertexBufferBinding.Declaration.CreateInputElements();
PipelineState.State.PrimitiveType = PrimitiveQuad.PrimitiveType;
}
/// <summary>
/// Draws this <see cref="GeometricPrimitive" />.View on GitHub (pinned to 96fad776d2)