{"record":{"id":"edb95e3352bac824","repo":"stride3d/stride","slug":"unsupported-format-when-converting-vertex-element-format","errorCode":null,"errorMessage":"Unsupported format when converting vertex element ({format})","messagePattern":"Unsupported format when converting vertex element \\((.+?)\\)","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Graphics/VertexBufferHelper.cs","lineNumber":176,"sourceCode":"            IConverter<Half2, TOutput>,\n            IConverter<Half4, TOutput>,\n            IConverter<UShort4, TOutput>,\n            IConverter<Byte4, TOutput>,\n            IConverter<Color, TOutput>,\n            ISemantic\n            where TOutput : unmanaged\n        {\n            switch (format)\n            {\n                case PixelFormat.R32G32_Float: InterleavedCopy<TSemantic, Vector2, TOutput>(param, srcElemOffset, destElemOffset); break;\n                case PixelFormat.R32G32B32_Float: InterleavedCopy<TSemantic, Vector3, TOutput>(param, srcElemOffset, destElemOffset); break;\n                case PixelFormat.R32G32B32A32_Float: InterleavedCopy<TSemantic, Vector4, TOutput>(param, srcElemOffset, destElemOffset); break;\n                case PixelFormat.R16G16_Float: InterleavedCopy<TSemantic, Half2, TOutput>(param, srcElemOffset, destElemOffset); break;\n                case PixelFormat.R16G16B16A16_Float: InterleavedCopy<TSemantic, Half4, TOutput>(param, srcElemOffset, destElemOffset); break;\n                case PixelFormat.R16G16B16A16_UInt: InterleavedCopy<TSemantic, UShort4, TOutput>(param, srcElemOffset, destElemOffset); break;\n                case PixelFormat.R8G8B8A8_UInt: InterleavedCopy<TSemantic, Byte4, TOutput>(param, srcElemOffset, destElemOffset); break;\n                case PixelFormat.R8G8B8A8_UNorm: InterleavedCopy<TSemantic, Color, TOutput>(param, srcElemOffset, destElemOffset); break;\n                default: throw new NotImplementedException($\"Unsupported format when converting vertex element ({format})\");\n            }\n        }\n        \n        static void InterleavedCopy<TConverter, TSourceSemVal, TDestSemVal>(InterleavedParameters param, int srcElemOffset, int destElemOffset) \n            where TConverter : IConverter<TSourceSemVal, TDestSemVal> \n            where TSourceSemVal : unmanaged\n            where TDestSemVal : unmanaged\n        {\n            fixed (byte* srcStart = param.Source)\n            fixed (byte* destStart = param.Destination)\n            {\n                for (byte* \n                     src = srcStart + srcElemOffset,\n                     dest = destStart + destElemOffset,\n                     endSrc = src + param.VertexCount * param.SourceStride;\n                     \n                     src < endSrc;\n                     ","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Graphics/VertexBufferHelper.cs#L158-L194","documentation":"This is the interleaved-copy path of VertexBufferHelper: it dispatches on the element's PixelFormat to choose a typed InterleavedCopy<T,...> instantiation. Only R32G32B32A32_Float, R16G16_Float, R16G16B16A16_Float, R16G16B16A16_UInt, R8G8B8A8_UInt and R8G8B8A8_UNorm are handled; any other format falls through to default and throws NotImplementedException. The library refuses to guess how to convert an unknown pixel layout.","triggerScenarios":"Calling the interleaved vertex conversion API (Convert with interleaved parameters) where the source vertex element's format is not one of the six supported PixelFormats, e.g. R32G32B32_Float or R8G8_UNorm.","commonSituations":"Mesh assets exported with compact or snorm formats from other tools; changing vertex compression settings in the pipeline; using a custom vertex declaration whose format differs from Stride's defaults.","solutions":["Change the vertex declaration to use a supported PixelFormat for that element","Pre-convert the vertex data into one of the six supported formats before conversion","Add a case to the format switch that calls InterleavedCopy with an appropriate unmanaged source type","Log elementData format values when the error occurs to know exactly which one to add or convert"],"exampleFix":"// before\nnew VertexElement(\"POSITION\", 0, PixelFormat.R32G32B32_Float, 0) // throws\n// after\nnew VertexElement(\"POSITION\", 0, PixelFormat.R32G32B32A32_Float, 0) // supported","handlingStrategy":"validation","validationCode":"if (!supportedFormats.Contains(elementFormat))\n    throw new InvalidOperationException($\"Interleaved conversion unsupported for {elementFormat}\");","typeGuard":null,"tryCatchPattern":"try { ConvertInterleaved(param); }\ncatch (NotImplementedException ex) { logger.Error(ex, \"Unsupported interleaved vertex format\"); throw; }","preventionTips":["Normalize vertex formats to supported ones during import","Keep custom declarations aligned with Stride's supported format list","Log all element formats of assets during pipeline runs"],"tags":["csharp","graphics","vertex-format","not-implemented"],"backgroundTag":"unsupported-enum-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}