Skip to content
Snippets Groups Projects
Commit 996a1ffb authored by Simeon Hermann's avatar Simeon Hermann
Browse files

[#36] add names of the reflected vertex inputs

parent 2278ebe5
No related branches found
No related tags found
1 merge request!49Resolve "Shader Program Reflection"
Pipeline #25495 passed
......@@ -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;
};
......
......@@ -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)) {
......
......@@ -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}
{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment