diff --git a/include/vkcv/VertexLayout.hpp b/include/vkcv/VertexLayout.hpp index ee0ad8ef56d5284af2be4c81b7ea2f0d052d5a6f..aae43910a09f221874813733b2ef72d36467a750 100644 --- a/include/vkcv/VertexLayout.hpp +++ b/include/vkcv/VertexLayout.hpp @@ -3,6 +3,7 @@ #include <unordered_map> #include <vector> #include <iostream> +#include <string> namespace vkcv{ @@ -38,10 +39,11 @@ namespace vkcv{ struct VertexInputAttachment{ VertexInputAttachment() = delete; - VertexInputAttachment(uint32_t location, uint32_t binding, VertexFormat format, uint32_t offset) noexcept; + VertexInputAttachment(uint32_t location, uint32_t binding, std::string name, VertexFormat format, uint32_t offset) noexcept; uint32_t location; uint32_t binding; + std::string name; VertexFormat format; uint32_t offset; }; diff --git a/src/vkcv/ShaderProgram.cpp b/src/vkcv/ShaderProgram.cpp index 59f8163c9dc75e0a716d80f2396665b0ba52c924..0a3ce87b93b5fa868c44cfc1e0c6ef4be0b8045f 100644 --- a/src/vkcv/ShaderProgram.cpp +++ b/src/vkcv/ShaderProgram.cpp @@ -119,9 +119,9 @@ namespace vkcv { for (uint32_t i = 0; i < resources.stage_inputs.size(); i++) { auto& u = resources.stage_inputs[i]; const spirv_cross::SPIRType& base_type = comp.get_type(u.base_type_id); - VertexInputAttachment input = VertexInputAttachment(comp.get_decoration(u.id, spv::DecorationLocation), 0, + u.name, convertFormat(base_type.basetype, base_type.vecsize), offset); inputVec.push_back(input); @@ -133,10 +133,10 @@ namespace vkcv { //Descriptor Sets //Storage buffer, uniform Buffer, storage image, sampled image, sampler (?) - std::vector<uint32_t> sampledImageVec; - for (uint32_t i = 0; i < resources.sampled_images.size(); i++) { - auto &u = resources.sampled_images[i]; - sampledImageVec.push_back(comp.get_decoration(u.id, spv::DecorationDescriptorSet)); + std::vector<uint32_t> separateImageVec; + for (uint32_t i = 0; i < resources.separate_images.size(); i++) { + auto &u = resources.separate_images[i]; + separateImageVec.push_back(comp.get_decoration(u.id, spv::DecorationDescriptorSet)); } std::vector<uint32_t> storageImageVec; @@ -163,7 +163,7 @@ namespace vkcv { samplerVec.push_back(comp.get_decoration(u.id, spv::DecorationDescriptorSet)); } - m_DescriptorSetLayout = DescriptorSetLayout(sampledImageVec, storageImageVec, uniformBufferVec, storageBufferVec, samplerVec); + m_DescriptorSetLayout = DescriptorSetLayout(separateImageVec, storageImageVec, uniformBufferVec, storageBufferVec, samplerVec); for (const auto &pushConstantBuffer : resources.push_constant_buffers) { for (const auto &range : comp.get_active_buffer_ranges(pushConstantBuffer.id)) { diff --git a/src/vkcv/VertexLayout.cpp b/src/vkcv/VertexLayout.cpp index b06c6743e1e19a5e282af248ab6b590eb97529fd..3a524d97865a06db3e8dbe22a390cafaee3a0226 100644 --- a/src/vkcv/VertexLayout.cpp +++ b/src/vkcv/VertexLayout.cpp @@ -30,9 +30,10 @@ namespace vkcv { return 0; } - VertexInputAttachment::VertexInputAttachment(uint32_t location, uint32_t binding, VertexFormat format, uint32_t offset) noexcept: + VertexInputAttachment::VertexInputAttachment(uint32_t location, uint32_t binding, std::string name, VertexFormat format, uint32_t offset) noexcept: location{location}, binding{binding}, + name{name}, format{format}, offset{offset} {}