Class VulkanShaderVariant

Inheritance Relationships

Base Type

Class Documentation

class VulkanShaderVariant : public portal::renderer::ShaderVariant

Vulkan shader modules with descriptor layouts and push constants.

Wraps compiled shader bytecode in vk::ShaderModule, creates descriptor set layouts from reflection data, and provides pipeline configuration.

Public Functions

VulkanShaderVariant(const StringId &name, const VulkanContext &context)

Constructs Vulkan shader variant.

Parameters:
  • name – Variant name

  • context – Vulkan context

~VulkanShaderVariant() override
void release()

Releases Vulkan resources.

virtual StringId get_name() const override

Gets variant name.

std::unordered_map<StringId, vk::WriteDescriptorSet> &get_write_descriptor_sets(size_t set_index)

Gets write descriptor sets for binding.

Parameters:

set_index – Descriptor set index

Returns:

Map of descriptor writes by name

vk::DescriptorSetLayout get_descriptor_layout(size_t set_index) const

Gets descriptor set layout.

Parameters:

set_index – Descriptor set index

Returns:

Vulkan descriptor set layout

std::vector<vk::DescriptorSetLayout> get_descriptor_layouts() const

Gets all descriptor set layouts.

const std::vector<vk::PushConstantRange> &get_push_constant_ranges() const

Gets push constant ranges.

virtual const std::unordered_map<StringId, shader_reflection::ShaderResourceDeclaration> &get_shader_resources() const override

Gets shader resource declarations.

virtual const ShaderReflection &get_reflection() const override

Gets shader reflection data.

const std::vector<vk::PipelineShaderStageCreateInfo> &get_shader_stage_create_infos() const

Gets pipeline shader stage create infos.

Protected Functions

void load(CompiledShader &&compiled_shader)

Loads compiled shader and creates Vulkan resources.

Parameters:

compiled_shader – Compiled bytecode and reflection

void create_descriptors()

Creates descriptor set layouts from reflection.