Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
ShaderManager Namespace Reference

Functions

VkPipelineShaderStageCreateInfo createVertexShaderInfo (VkDevice logDevice, ObjectType objectType)
 Creates a vertex shader info to be used in pipeline creation. More...
 
VkPipelineShaderStageCreateInfo createFragmentShaderInfo (VkDevice logDevice, ObjectType objectType)
 Creates a fragment shader info to be used in pipeline creation. More...
 
void destroyShaderModules (VkDevice logDevice)
 Destroys created shader modules. This function can be called after pipeline creation. More...
 
std::vector< uint32_t > compileGLSLToSpirv (VkShaderStageFlagBits shaderType, ObjectType object)
 Compiles a given GLSL code to SPIRV. More...
 
std::string getShaderCode (VkShaderStageFlags stage, ObjectType object)
 Returns the shader code as a string corresponding to the given stage and object type. More...
 
static std::vector< char > readFile (ConstantFilepath filepath)
 Reads a file and returns a vector of chars. More...
 
static VkShaderModule createShaderModule (VkDevice logDevice, VkShaderStageFlagBits stage, ObjectType objectType)
 Creates a shader module from a file. More...
 

Variables

constexpr ConstantFilepath kGLSLTestVertexShaderPath = "shaders/testShader.vert"
 
constexpr ConstantFilepath kGLSLTestFragmentShaderPath = "shaders/testShader.frag"
 
constexpr ConstantFilepath kGLSLObjectVertexShaderPath = "shaders/objectShader.vert"
 
constexpr ConstantFilepath kGLSLObjectFragmentShaderPath = "shaders/objectShader.frag"
 
constexpr const char * kStandardEntryPoint = "main"
 
static std::vector< VkShaderModule > createdModules
 

Function Documentation

◆ compileGLSLToSpirv()

std::vector< uint32_t > ShaderManager::compileGLSLToSpirv ( VkShaderStageFlagBits  shaderType,
ObjectType  object 
)

Compiles a given GLSL code to SPIRV.

Parameters
glslCodeGLSL code as a string
shaderTypeShader type enum
Returns
Compiled SPIRV aligned to 4 bytes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createFragmentShaderInfo()

VkPipelineShaderStageCreateInfo ShaderManager::createFragmentShaderInfo ( VkDevice  logDevice,
ObjectType  objectType 
)

Creates a fragment shader info to be used in pipeline creation.

Parameters
logDeviceLogical device.
Returns
Creation info.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createShaderModule()

VkShaderModule ShaderManager::createShaderModule ( VkDevice  logDevice,
VkShaderStageFlagBits  stage,
ObjectType  objectType 
)
static

Creates a shader module from a file.

Parameters
logDeviceThe logical device.
stageShader stage
Returns
Created shader module.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createVertexShaderInfo()

VkPipelineShaderStageCreateInfo ShaderManager::createVertexShaderInfo ( VkDevice  logDevice,
ObjectType  objectType 
)

Creates a vertex shader info to be used in pipeline creation.

Parameters
logDeviceLogical device.
Returns
Creation info.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroyShaderModules()

void ShaderManager::destroyShaderModules ( VkDevice  logDevice)

Destroys created shader modules. This function can be called after pipeline creation.

Parameters
logDeviceThe logical device.
Here is the caller graph for this function:

◆ getShaderCode()

std::string ShaderManager::getShaderCode ( VkShaderStageFlags  stage,
ObjectType  object 
)

Returns the shader code as a string corresponding to the given stage and object type.

Parameters
stageof the shader
objecttype
Returns
shader code as a string
Here is the caller graph for this function:

◆ readFile()

std::vector< char > ShaderManager::readFile ( ConstantFilepath  filepath)
static

Reads a file and returns a vector of chars.

Parameters
rFilenameName of the file to read.
Returns
A vector of characters read from the file.

Variable Documentation

◆ createdModules

std::vector<VkShaderModule> ShaderManager::createdModules
static

◆ kGLSLObjectFragmentShaderPath

constexpr ConstantFilepath ShaderManager::kGLSLObjectFragmentShaderPath = "shaders/objectShader.frag"
constexpr

◆ kGLSLObjectVertexShaderPath

constexpr ConstantFilepath ShaderManager::kGLSLObjectVertexShaderPath = "shaders/objectShader.vert"
constexpr

◆ kGLSLTestFragmentShaderPath

constexpr ConstantFilepath ShaderManager::kGLSLTestFragmentShaderPath = "shaders/testShader.frag"
constexpr

◆ kGLSLTestVertexShaderPath

constexpr ConstantFilepath ShaderManager::kGLSLTestVertexShaderPath = "shaders/testShader.vert"
constexpr

◆ kStandardEntryPoint

constexpr const char* ShaderManager::kStandardEntryPoint = "main"
constexpr