Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ZEngine/ZEngine/Rendering/Shaders/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace ZEngine::Rendering::Shaders
LayoutBindingSpecificationMap[set].init(m_device->Arena, 10);
}

LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::VERTEX});
LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::VERTEX});
}

for (const auto& SB_resource : vertex_resources.storage_buffers)
Expand All @@ -111,7 +111,7 @@ namespace ZEngine::Rendering::Shaders
LayoutBindingSpecificationMap[set].init(m_device->Arena, 10);
}

LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::VERTEX});
LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::VERTEX});
}

for (const auto& pushConstant_resource : vertex_resources.push_constant_buffers)
Expand All @@ -127,7 +127,7 @@ namespace ZEngine::Rendering::Shaders
uint32_t memberSize = spirv_compiler->get_declared_struct_member_size(type, i);
struct_total_size += memberSize;
}
PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name, .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::VERTEX});
PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name.c_str(), .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::VERTEX});
/*
* We update the offset for next iteration
*/
Expand Down Expand Up @@ -167,7 +167,7 @@ namespace ZEngine::Rendering::Shaders
LayoutBindingSpecificationMap[set].init(m_device->Arena, 10);
}

LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name, .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::FRAGMENT});
LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = UB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::UNIFORM_BUFFER, .Flags = ShaderStageFlags::FRAGMENT});
}

for (const auto& SB_resource : fragment_resources.storage_buffers)
Expand All @@ -180,7 +180,7 @@ namespace ZEngine::Rendering::Shaders
LayoutBindingSpecificationMap[set].init(m_device->Arena, 10);
}

LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name, .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::FRAGMENT});
LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Name = SB_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::STORAGE_BUFFER, .Flags = ShaderStageFlags::FRAGMENT});
}

for (const auto& pushConstant_resource : fragment_resources.push_constant_buffers)
Expand All @@ -196,7 +196,7 @@ namespace ZEngine::Rendering::Shaders
uint32_t memberSize = spirv_compiler->get_declared_struct_member_size(type, i);
struct_total_size += memberSize;
}
PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name, .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::FRAGMENT});
PushConstantSpecifications.push(PushConstantSpecification{.Name = pushConstant_resource.name.c_str(), .Size = struct_total_size, .Offset = struct_offset, .Flags = ShaderStageFlags::FRAGMENT});
/*
* We update the offset for next iteration
*/
Expand Down Expand Up @@ -225,7 +225,7 @@ namespace ZEngine::Rendering::Shaders
LayoutBindingSpecificationMap[set].init(m_device->Arena, 10);
}

LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Count = count, .Name = SI_resource.name, .DescriptorTypeValue = DescriptorType::COMBINED_IMAGE_SAMPLER, .Flags = ShaderStageFlags::FRAGMENT});
LayoutBindingSpecificationMap[set].push(LayoutBindingSpecification{.Set = set, .Binding = binding, .Count = count, .Name = SI_resource.name.c_str(), .DescriptorTypeValue = DescriptorType::COMBINED_IMAGE_SAMPLER, .Flags = ShaderStageFlags::FRAGMENT});
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions ZEngine/ZEngine/Rendering/Specifications/ShaderSpecification.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <ZEngineDef.h>
#include <vulkan/vulkan.h>

namespace ZEngine::Rendering::Specifications
Expand Down Expand Up @@ -38,25 +39,25 @@ namespace ZEngine::Rendering::Specifications
uint32_t Set{0xFFFFFFFF};
uint32_t Binding{0xFFFFFFFF};
uint32_t Count{1};
std::string Name;
cstring Name;
DescriptorType DescriptorTypeValue;
ShaderStageFlags Flags;
};

struct PushConstantSpecification
{
std::string Name;
cstring Name;
uint32_t Size;
uint32_t Offset;
ShaderStageFlags Flags;
};

struct ShaderSpecification
{
uint32_t OverloadMaxSet = 1;
uint32_t OverloadPoolSize = 0;
const char* VertexFilename = {};
const char* FragmentFilename = {};
const char* Name = {};
uint32_t OverloadMaxSet = 1;
uint32_t OverloadPoolSize = 0;
cstring VertexFilename = {};
cstring FragmentFilename = {};
cstring Name = {};
};
} // namespace ZEngine::Rendering::Specifications
Loading