Class Shader

Class Documentation

class inexor::vulkan_renderer::wrapper::Shader

RAII wrapper class for VkShaderModules.

Public Functions

Shader(const Device &m_device, VkShaderStageFlagBits type, const std::string &name, const std::vector<char> &code, const std::string &entry_point = "main")

Construct a shader module from a block of SPIR-V memory.

Parameters
  • device – The const reference to a device RAII wrapper instance.

  • type – The shader type.

  • name – The internal debug marker name of the VkShaderModule.

  • code – The memory block of the SPIR-V shader.

  • entry_point – The name of the entry point, “main” by default.

Shader(const Device &m_device, VkShaderStageFlagBits type, const std::string &name, const std::string &file_name, const std::string &entry_point = "main")

Construct a shader module from a SPIR-V file. This constructor loads the file content and just calls the other constructor.

Parameters
  • device – The const reference to a device RAII wrapper instance.

  • type – The shader type.

  • name – The internal debug marker name of the VkShaderModule.

  • file_name – The name of the SPIR-V shader file to load.

  • entry_point – The name of the entry point, “main” by default.

Shader(const Shader&) = delete
Shader(Shader&&) noexcept
~Shader()
Shader &operator=(const Shader&) = delete
Shader &operator=(Shader&&) = delete
inline const std::string &name() const
inline const std::string &entry_point() const
inline VkShaderStageFlagBits type() const
inline VkShaderModule module() const

Private Members

const Device &m_device
std::string m_name
std::string m_entry_point
VkShaderStageFlagBits m_type
VkShaderModule m_shader_module = {VK_NULL_HANDLE}