![]() |
Kale
|
#include <Shader.hpp>
Public Member Functions | |
Shader () | |
Shader (const std::string &filename, ShaderType type, Device &device) | |
void | init (const std::string &filename, ShaderType type, Device &device) |
void | freeResources (bool remove=true) override |
vk::ShaderStageFlagBits | getShaderStage () const |
vk::PipelineShaderStageCreateInfo | getShaderPipelineInfo () const |
Public Attributes | |
ShaderType | type |
vk::UniqueShaderModule | shader |
Private Member Functions | |
std::vector< char > | readFile (const std::string &filename) const |
void | createShaderModule (const std::vector< char > &code) |
Additional Inherited Members | |
![]() | |
ChildResource () | |
ChildResource (Device &parent) | |
virtual void | init (Device &parent) |
~ChildResource () | |
![]() | |
Device * | parentPtr |
Represents a simple Spir-V shader
Definition at line 44 of file Shader.hpp.
Shader::Shader | ( | ) |
Creates an uninitialized object
Definition at line 33 of file Shader.cpp.
Shader::Shader | ( | const std::string & | filename, |
ShaderType | type, | ||
Device & | device ) |
Creates and initializes the object
filename | The filename of the shader to create from |
type | The type of shader |
device | The device to link the shader to |
If | unable to open the file |
Definition at line 44 of file Shader.cpp.
|
private |
Creates the shader module given the byte code
code | The byte code |
Definition at line 84 of file Shader.cpp.
|
overridevirtual |
Frees resources for this shader
Reimplemented from Kale::Vulkan::ChildResource< Device >.
Definition at line 93 of file Shader.cpp.
vk::PipelineShaderStageCreateInfo Shader::getShaderPipelineInfo | ( | ) | const |
Gets the shader pipeline create information from this shader module
Definition at line 117 of file Shader.cpp.
vk::ShaderStageFlagBits Shader::getShaderStage | ( | ) | const |
Gets the shader stage from the type
Definition at line 102 of file Shader.cpp.
void Shader::init | ( | const std::string & | filename, |
ShaderType | type, | ||
Device & | device ) |
Initializes this object
filename | The shader file to initialize from |
type | The type of shader this is |
device | The device to link the shader to |
If | unable to open the file |
Definition at line 56 of file Shader.cpp.
|
private |
Reads a shader file
filename | The file name |
If | unable to open the file |
Definition at line 69 of file Shader.cpp.
vk::UniqueShaderModule Kale::Vulkan::Shader::shader |
The shader module
Definition at line 70 of file Shader.hpp.
ShaderType Kale::Vulkan::Shader::type |
The type of shader
Definition at line 65 of file Shader.hpp.