stride3d/stride · error · NotImplementedException
Sorting not implemented for multiple vertex buffers by…
Error message
Sorting not implemented for multiple vertex buffers by submeshdata
What it means
SortMeshPolygons only operates on meshes with exactly one vertex buffer; its polygon-sorting code is not implemented for multiple vertex buffers. This NotImplementedException is thrown when meshData.VertexBuffers.Length != 1.
Solutions
- Re-interleave the mesh into a single vertex buffer before sorting
- Exclude multi-buffer meshes from polygon sorting
- Prefer GenerateTangentBinormal-style single-buffer meshes (IsSimple) in the pipeline feeding SortMeshPolygons
Example fix
// before sort.SortMeshPolygons(multiStreamMesh, viewDir); // 2 vertex buffers // after var single = InterleaveVertexBuffers(multiStreamMesh); sort.SortMeshPolygons(single, viewDir);
Defensive patterns
Strategy: validation
Validate before calling
if (mesh.VertexBuffers == null || mesh.VertexBuffers.Length != 1)
mesh = InterleaveToSingleVertexBuffer(mesh); Type guard
static bool IsSingleBuffer(MeshDraw mesh) =>
mesh.VertexBuffers != null && mesh.VertexBuffers.Length == 1; Try / catch
try { mesh.SortMeshPolygons(viewDir); }
catch (NotImplementedException) { /* re-interleave to one buffer or skip */ } Prevention
- Avoid multi-stream vertex layouts for meshes that need post-processing passes
- Re-interleave after any merge that yields multiple buffers
- Prefer IsSimple meshes throughout the geometry pipeline
When it happens
Trigger: Calling SortMeshPolygons on a MeshDraw with 2+ VertexBuffers (e.g. separate position and attribute buffers, or multiple streams).
Common situations: Meshes using multi-stream vertex layouts; meshes from importers that split position data from attribute data; merging workflows that produced multi-buffer meshes.
Related errors
- Non-matching vertex buffer declarations.
- Can only merge TriangleList.
- The mesh Data needs to have index buffer
- meshData is not simple.
- msaaResolverShaderName
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/22a804f9e1507e15.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Rendering/Extensions/PolySortExtensions.cs:25
using Stride.Core.Mathematics;
using Stride.Graphics;
using Stride.Graphics.Data;
using Stride.Rendering;
namespace Stride.Extensions
{
public static class PolySortExtensions
{
public static unsafe void SortMeshPolygons(this MeshDraw meshData, Vector3 viewDirectionForSorting)
{
// need to have alreade an vertex buffer
if (meshData.VertexBuffers == null)
throw new ArgumentException();
// For now, require a MeshData with an index buffer
if (meshData.IndexBuffer == null)
throw new NotImplementedException("The mesh Data needs to have index buffer");
if (meshData.VertexBuffers.Length != 1)
throw new NotImplementedException("Sorting not implemented for multiple vertex buffers by submeshdata");
if (viewDirectionForSorting == Vector3.Zero)
{
// By default to -Z if sorting is set to null
viewDirectionForSorting = -Vector3.UnitZ;
}
const uint PolySize = 3; // currently only triangle list are supported
var polyIndicesSize = PolySize * sizeof(int);
var vertexBuffer = meshData.VertexBuffers[0];
var oldIndexBuffer = meshData.IndexBuffer;
var vertexStride = vertexBuffer.Declaration.VertexStride;
// Generate the sort list
var sortList = new List<KeyValuePair<int, Vector3>>();
fixed (byte* vertexBufferPointerStart = &vertexBuffer.Buffer.GetSerializationData().Content[vertexBuffer.Offset])
fixed (byte* indexBufferPointerStart = &oldIndexBuffer.Buffer.GetSerializationData().Content[oldIndexBuffer.Offset])View on GitHub (pinned to 96fad776d2)