From 36581a06a05b45aa171948b97edf9273ed6de8df Mon Sep 17 00:00:00 2001 From: Mark Oliver Mints <mmints@uni-koblenz.de> Date: Fri, 28 May 2021 17:41:48 +0200 Subject: [PATCH] [#33][Impl] Get Vertex Layout from Shader Reflection and us it for ONE Vertex Input --- src/vkcv/PipelineManager.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/vkcv/PipelineManager.cpp b/src/vkcv/PipelineManager.cpp index e6d6beea..4475e554 100644 --- a/src/vkcv/PipelineManager.cpp +++ b/src/vkcv/PipelineManager.cpp @@ -66,9 +66,27 @@ namespace vkcv nullptr ); + VertexLayout layout = config.m_ShaderProgram.getVertexLayout(); + std::unordered_map<uint32_t, VertexInputAttachment> attachments = layout.attachmentMap; + + VertexInputAttachment attachment = attachments.at(0); + uint32_t location = attachment.location; + uint32_t binding = attachment.binding; + uint32_t offset = attachment.offset; + VertexFormat format = attachment.format; + + std::cout << "--------------------------------" << std::endl; + std::cout << "Debug Print From PipelineManager" << std::endl; + std::cout << "Layout.stride: " << layout.stride << std::endl; + std::cout << "Location: " << location << std::endl; + std::cout << "Binding: " << binding << std::endl; + std::cout << "Offset: " << offset << std::endl; + std::cout << "Format: " << (int)format << std::endl; + std::cout << "--------------------------------" << std::endl; + // vertex input state - vk::VertexInputBindingDescription vertexInputBindingDescription(0, 12, vk::VertexInputRate::eVertex); - vk::VertexInputAttributeDescription vertexInputAttributeDescription(0, 0, vk::Format::eR32G32B32Sfloat, 0); + vk::VertexInputBindingDescription vertexInputBindingDescription(binding, layout.stride, vk::VertexInputRate::eVertex); // TODO: What's with the input rate? + vk::VertexInputAttributeDescription vertexInputAttributeDescription(location, binding, static_cast<vk::Format>(format), offset); // TODO: Format -> cast to vk::Format? vk::PipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo( {}, // no vertex input until vertex buffer is implemented -- GitLab