From b288f27937e05d63e0425abe3b52a8c6a30163e0 Mon Sep 17 00:00:00 2001 From: Alex Laptop <alexander.gauggel@web.de> Date: Tue, 14 Sep 2021 14:06:57 +0200 Subject: [PATCH] [#105] Sort out (some) of the vertex mess --- projects/draw_indirect/src/main.cpp | 8 +------- src/vkcv/VertexLayout.cpp | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/projects/draw_indirect/src/main.cpp b/projects/draw_indirect/src/main.cpp index 2f93f497..385e78aa 100644 --- a/projects/draw_indirect/src/main.cpp +++ b/projects/draw_indirect/src/main.cpp @@ -227,12 +227,7 @@ int main(int argc, const char** argv) { // vertex layout for the pipeline. (assumed to be) used by all sponza meshes. const std::vector<vkcv::VertexAttachment> vertexAttachments = sponzaProgram.getVertexAttachments(); - std::vector<vkcv::VertexBinding> bindings; - for (size_t i = 0; i < vertexAttachments.size(); i++) - { - bindings.push_back(vkcv::VertexBinding(i, { vertexAttachments[i] })); - } - const vkcv::VertexLayout sponzaVertexLayout (bindings); + const vkcv::VertexLayout sponzaVertexLayout({ vkcv::VertexBinding(0, { vertexAttachments }) }); // recreation of VertexBufferBindings YET AGAIN, // since these are used in the command buffer to bind and draw from the vertex shaders @@ -247,7 +242,6 @@ int main(int argc, const char** argv) { compiledIndexBuffer, indexedIndirectCommands); - vkcv::Buffer<vk::DrawIndexedIndirectCommand> indirectBuffer = core.createBuffer<vk::DrawIndexedIndirectCommand>( vkcv::BufferType::INDIRECT, indexedIndirectCommands.size() * sizeof(vk::DrawIndexedIndirectCommand), diff --git a/src/vkcv/VertexLayout.cpp b/src/vkcv/VertexLayout.cpp index fa079a32..0edced57 100644 --- a/src/vkcv/VertexLayout.cpp +++ b/src/vkcv/VertexLayout.cpp @@ -46,8 +46,8 @@ namespace vkcv { uint32_t offset = 0; for (auto &attachment : vertexAttachments) { - offset += getFormatSize(attachment.format); attachment.offset = offset; + offset += getFormatSize(attachment.format); } stride = offset; } -- GitLab