vpr::ShaderModule class

A thoroughly thin wrapper around a VkShaderModule object, whose primary utility beyond RAII resource management is setting up the VkPipelineShaderStageCreateInfo required when creating/setting up an objects graphics pipeline.

Constructors, destructors, conversion operators

ShaderModule(const VkDevice& device, const char* filename, const VkShaderStageFlagBits& stages, const char* entry_point = nullptr)
Creates a new shader for the given stage by reading from the specified file.
ShaderModule(const VkDevice& device, const VkShaderStageFlagBits& stages, const uint32_t* binary_source, const uint32_t& binary_source_length)
Creates a new shader for the given stage by using the given binary data array.

Public functions

auto PipelineInfo() const -> const VkPipelineShaderStageCreateInfo& noexcept
Retrieves the object required to bind/use this shader in a pipeline.

Function documentation

vpr::ShaderModule::ShaderModule(const VkDevice& device, const char* filename, const VkShaderStageFlagBits& stages, const char* entry_point = nullptr)

Creates a new shader for the given stage by reading from the specified file.

Parameters
device
filename
stages
entry_point This optional parameter decides what point to invoke/execute the given shader from.

vpr::ShaderModule::ShaderModule(const VkDevice& device, const VkShaderStageFlagBits& stages, const uint32_t* binary_source, const uint32_t& binary_source_length)

Creates a new shader for the given stage by using the given binary data array.

Will be slightly faster, as it doesn't have to open a file and copy that data into the program.

const VkPipelineShaderStageCreateInfo& vpr::ShaderModule::PipelineInfo() const noexcept

Retrieves the object required to bind/use this shader in a pipeline.

Fields are already filled out: should not be modified. Only potential modification point would be changing the entry point, after creating a fresh copy of this object - this is left to advanced users though, so it won't be explained more here.