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 @@ ...@@ -3,6 +3,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <string>
namespace vkcv{ namespace vkcv{
...@@ -38,10 +39,11 @@ namespace vkcv{ ...@@ -38,10 +39,11 @@ namespace vkcv{
struct VertexInputAttachment{ struct VertexInputAttachment{
VertexInputAttachment() = delete; 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 location;
uint32_t binding; uint32_t binding;
std::string name;
VertexFormat format; VertexFormat format;
uint32_t offset; uint32_t offset;
}; };
......
...@@ -119,9 +119,9 @@ namespace vkcv { ...@@ -119,9 +119,9 @@ namespace vkcv {
for (uint32_t i = 0; i < resources.stage_inputs.size(); i++) { for (uint32_t i = 0; i < resources.stage_inputs.size(); i++) {
auto& u = resources.stage_inputs[i]; auto& u = resources.stage_inputs[i];
const spirv_cross::SPIRType& base_type = comp.get_type(u.base_type_id); const spirv_cross::SPIRType& base_type = comp.get_type(u.base_type_id);
VertexInputAttachment input = VertexInputAttachment(comp.get_decoration(u.id, spv::DecorationLocation), VertexInputAttachment input = VertexInputAttachment(comp.get_decoration(u.id, spv::DecorationLocation),
0, 0,
u.name,
convertFormat(base_type.basetype, base_type.vecsize), convertFormat(base_type.basetype, base_type.vecsize),
offset); offset);
inputVec.push_back(input); inputVec.push_back(input);
...@@ -133,10 +133,10 @@ namespace vkcv { ...@@ -133,10 +133,10 @@ namespace vkcv {
//Descriptor Sets //Descriptor Sets
//Storage buffer, uniform Buffer, storage image, sampled image, sampler (?) //Storage buffer, uniform Buffer, storage image, sampled image, sampler (?)
std::vector<uint32_t> sampledImageVec; std::vector<uint32_t> separateImageVec;
for (uint32_t i = 0; i < resources.sampled_images.size(); i++) { for (uint32_t i = 0; i < resources.separate_images.size(); i++) {
auto &u = resources.sampled_images[i]; auto &u = resources.separate_images[i];
sampledImageVec.push_back(comp.get_decoration(u.id, spv::DecorationDescriptorSet)); separateImageVec.push_back(comp.get_decoration(u.id, spv::DecorationDescriptorSet));
} }
std::vector<uint32_t> storageImageVec; std::vector<uint32_t> storageImageVec;
...@@ -163,7 +163,7 @@ namespace vkcv { ...@@ -163,7 +163,7 @@ namespace vkcv {
samplerVec.push_back(comp.get_decoration(u.id, spv::DecorationDescriptorSet)); 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 &pushConstantBuffer : resources.push_constant_buffers) {
for (const auto &range : comp.get_active_buffer_ranges(pushConstantBuffer.id)) { for (const auto &range : comp.get_active_buffer_ranges(pushConstantBuffer.id)) {
......
...@@ -30,9 +30,10 @@ namespace vkcv { ...@@ -30,9 +30,10 @@ namespace vkcv {
return 0; 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}, location{location},
binding{binding}, binding{binding},
name{name},
format{format}, format{format},
offset{offset} 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