diff --git a/projects/indirect_draw/src/main.cpp b/projects/indirect_draw/src/main.cpp index 2514145dad691f21e7d646fb3c4febe5ef912417..45de9ad010cfc59cac0b9ab929a1c19e43cabc38 100644 --- a/projects/indirect_draw/src/main.cpp +++ b/projects/indirect_draw/src/main.cpp @@ -93,6 +93,13 @@ void interleaveScene(vkcv::asset::Scene scene, { for(auto vertexGroupIndex : mesh.vertexGroups) { + // Sort attributes to fix it! + auto& attributes = scene.vertexGroups[vertexGroupIndex].vertexBuffer.attributes; + + std::sort(attributes.begin(), attributes.end(), [](const vkcv::asset::VertexAttribute& x, const vkcv::asset::VertexAttribute& y) { + return static_cast<uint32_t>(x.type) < static_cast<uint32_t>(y.type); + }); + const auto &vertexGroup = scene.vertexGroups[vertexGroupIndex]; const vkcv::asset::VertexAttribute positionAttribute = vertexGroup.vertexBuffer.attributes[0];