{"record":{"id":"390b277d1f7b3a1d","repo":"stride3d/stride","slug":"cannot-generate-more-than-65535-indices-on-feature-level-hw-390b27","errorCode":null,"errorMessage":"Cannot generate more than 65535 indices on feature level HW <= 9.3","messagePattern":"Cannot generate more than 65535 indices on feature level HW <= 9\\.3","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/ProceduralModels/PrimitiveProceduralModelBase.cs","lineNumber":171,"sourceCode":"            if (indices.Length < 0xFFFF)\n            {\n                var indicesShort = new ushort[indices.Length];\n                for (int i = 0; i < indicesShort.Length; i++)\n                {\n                    indicesShort[i] = (ushort)indices[i];\n                }\n                meshDraw.IndexBuffer = new IndexBufferBinding(Buffer.Index.New(graphicsDevice, indicesShort).RecreateWith(indicesShort), false, indices.Length);\n                if (needsTempDevice)\n                {\n                    var indexData = BufferData.New(BufferFlags.IndexBuffer, indicesShort);\n                    meshDraw.IndexBuffer = new IndexBufferBinding(indexData.ToSerializableVersion(), false, indices.Length);\n                }\n            }\n            else\n            {\n                if (graphicsDevice.Features.CurrentProfile <= GraphicsProfile.Level_9_3)\n                {\n                    throw new InvalidOperationException(\"Cannot generate more than 65535 indices on feature level HW <= 9.3\");\n                }\n\n                meshDraw.IndexBuffer = new IndexBufferBinding(Buffer.Index.New(graphicsDevice, indices).RecreateWith(indices), true, indices.Length);\n                if (needsTempDevice)\n                {\n                    var indexData = BufferData.New(BufferFlags.IndexBuffer, indices);\n                    meshDraw.IndexBuffer = new IndexBufferBinding(indexData.ToSerializableVersion(), true, indices.Length);\n                }\n            }\n\n            var vertexBuffer = Buffer.New(graphicsDevice, vertexBufferData, BufferFlags.VertexBuffer, GraphicsResourceUsage.Default);\n            meshDraw.VertexBuffers = [ new VertexBufferBinding(vertexBuffer.RecreateWith(vertexBufferData), layout, data.Vertices.Length) ];\n            if (needsTempDevice)\n            {\n                var vertexData = BufferData.New(BufferFlags.VertexBuffer, vertexBufferData);\n                meshDraw.VertexBuffers = [ new VertexBufferBinding(vertexData.ToSerializableVersion(), layout, data.Vertices.Length) ];\n            }\n","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/ProceduralModels/PrimitiveProceduralModelBase.cs#L153-L189","documentation":"When a procedural primitive generates more than 65535 indices, a 32-bit index buffer is required. On GraphicsProfile.Level_9_3 or lower hardware, 32-bit indices are not supported, so Generate throws InvalidOperationException instead of producing a mesh that cannot render.","triggerScenarios":"Generating a high-tessellation primitive (sphere, torus, etc.) whose vertex/index count exceeds 65535 while the target GraphicsDevice's CurrentProfile is Level_9_3 or below (old GPUs or forced low profile / feature level).","commonSituations":"Games targeting low-end or HiDef-limited devices; running on old hardware or an emulator that caps the graphics profile; users cranking tessellation parameters beyond 16-bit index limits.","solutions":["Reduce tessellation/subdivision parameters so the index count stays at or below 65535","Raise the minimum GraphicsProfile to Level_10_0 in device creation and require 32-bit index support","Split the primitive into multiple meshes/chunks each within the 16-bit index budget"],"exampleFix":"// before\nvar sphere = new SphereProceduralModel { Tessellation = 64 }; // >65535 indices, fails on Level_9_3\n// after\nvar sphere = new SphereProceduralModel { Tessellation = 32 }; // stays within 65535 indices\n// or request a higher profile when creating the device\nvar parameters = new GameParameters { RequiredGraphicsProfile = GraphicsProfile.Level_10_0 };","handlingStrategy":"validation","validationCode":"if (indices.Length > 65535 && graphicsDevice.Features.CurrentProfile <= GraphicsProfile.Level_9_3)\n    throw new NotSupportedException(\"Reduce tessellation or require Level_10_0\");","typeGuard":"static bool Supports32BitIndices(GraphicsDevice d) => d.Features.CurrentProfile > GraphicsProfile.Level_9_3;","tryCatchPattern":"try { primitive.Generate(services, model); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"65535\")) {\n    primitive.Tessellation = Math.Max(1, primitive.Tessellation / 2); // regenerate smaller\n}","preventionTips":["Check GraphicsProfile capability before generating large primitives","Keep procedural tessellation within the 65535 index budget","Set RequiredGraphicsProfile = Level_10_0 if high-detail primitives are mandatory"],"tags":["rendering","procedural-models","hardware-limits"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}