SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::vk::VulkanShaderModule Class Referencefinal

Vulkan implementation of a IShaderModule. More...

#include <VulkanShaderModule.h>

Inheritance diagram for spark::render::vk::VulkanShaderModule:
spark::render::IShaderModule spark::render::Resource< VkShaderModule > spark::render::IResource< VkShaderModule >

Classes

struct  Impl
 

Public Member Functions

 VulkanShaderModule (const VulkanDevice &device, ShaderStage type, const std::filesystem::path &file_name, const std::string &entry_point="main")
 Initializes a new VulkanShaderModule from a file.
 
 VulkanShaderModule (const VulkanDevice &device, ShaderStage type, std::istream &stream, const std::string &name, const std::string &entry_point="main")
 Initializes a new VulkanShaderModule from a std::istream.
 
 VulkanShaderModule (const VulkanShaderModule &other)=delete
 
 VulkanShaderModule (VulkanShaderModule &&other) noexcept=delete
 
VulkanShaderModuleoperator= (const VulkanShaderModule &other)=delete
 
VulkanShaderModuleoperator= (VulkanShaderModule &&other) noexcept=delete
 
const std::string & byteCode () const noexcept
 Gets the shader byte code.
 
ShaderStage stage () const noexcept override
 Gets the type of the shader.
 
const std::string & fileName () const noexcept override
 Gets the name of the file this shader was loaded from.
 
const std::string & entryPoint () const noexcept override
 Gets the entry point of this shader.
 
- Public Member Functions inherited from spark::render::Resource< VkShaderModule >
 Resource (VkShaderModule handle) noexcept
 Initializes the managed resource with the given handle.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other) noexcept=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other) noexcept=delete
 
const VkShaderModule & handle () const final
 Gets the managed resource handle.
 

Additional Inherited Members

- Public Types inherited from spark::render::IResource< VkShaderModule >
using handle_type
 
- Protected Member Functions inherited from spark::render::Resource< VkShaderModule >
VkShaderModule & handle () final
 Gets the managed resource handle.
 

Detailed Description

Vulkan implementation of a IShaderModule.

Constructor & Destructor Documentation

◆ VulkanShaderModule() [1/2]

spark::render::vk::VulkanShaderModule::VulkanShaderModule ( const VulkanDevice & device,
ShaderStage type,
const std::filesystem::path & file_name,
const std::string & entry_point = "main" )
explicit

Initializes a new VulkanShaderModule from a file.

Parameters
deviceThe parent VulkanDevice this shader has been created from.
typeThe ShaderStage of this shader.
file_nameThe path to the shader file.
entry_pointThe name of the entry point of the shader.
Exceptions
base::CouldNotOpenFileExceptionIf the file could not be opened.
base::CouldNotCreateShaderExceptionIf the shader could not be created.

◆ VulkanShaderModule() [2/2]

spark::render::vk::VulkanShaderModule::VulkanShaderModule ( const VulkanDevice & device,
ShaderStage type,
std::istream & stream,
const std::string & name,
const std::string & entry_point = "main" )
explicit

Initializes a new VulkanShaderModule from a std::istream.

Parameters
deviceThe parent VulkanDevice this shader has been created from.
typeThe ShaderStage of this shader.
streamThe std::istream containing the shader byte code.
nameThe file name of the shader.
entry_pointThe name of the entry point of the shader.
Exceptions
base::CouldNotCreateShaderExceptionIf the shader could not be created.

Member Function Documentation

◆ byteCode()

const std::string & spark::render::vk::VulkanShaderModule::byteCode ( ) const
nodiscardnoexcept

Gets the shader byte code.

Returns
A std::string containing the shader byte code.

◆ entryPoint()

const std::string & spark::render::vk::VulkanShaderModule::entryPoint ( ) const
nodiscardoverridevirtualnoexcept

Gets the entry point of this shader.

Returns
A std::string containing the name of the entry point of this shader.

Implements spark::render::IShaderModule.

◆ fileName()

const std::string & spark::render::vk::VulkanShaderModule::fileName ( ) const
nodiscardoverridevirtualnoexcept

Gets the name of the file this shader was loaded from.

Returns
A std::string containing the name of the file this shader was loaded from.

Implements spark::render::IShaderModule.

◆ stage()

ShaderStage spark::render::vk::VulkanShaderModule::stage ( ) const
nodiscardoverridevirtualnoexcept

Gets the type of the shader.

Returns
A ShaderStage representing the stage of the pipeline this shader is used in.

Implements spark::render::IShaderModule.