* @brief ShaderProgram class to handle and prepare the shader stages for a graphics pipeline
*/
#include<unordered_map>
#include<fstream>
#include<iostream>
#include<filesystem>
#include<vulkan/vulkan.hpp>
namespacevkcv{
enumclassShaderStage
{
VERTEX,
TESS_CONTROL,
TESS_EVAL,
GEOMETRY,
FRAGMENT,
COMPUTE
};
structShader
{
std::vector<char>shaderCode;
ShaderStageshaderStage;
};
classShaderProgram
{
public:
ShaderProgram()noexcept;// ctor
~ShaderProgram()=default;// dtor
/**
* Adds a shader into the shader program.
* The shader is only added if the shader program does not contain the particular shader stage already.
* Contains: (1) reading of the code, (2) creation of a shader module, (3) creation of a shader stage, (4) adding to the shader stage list, (5) destroying of the shader module
* @param[in] flag that signals the respective shaderStage (e.g. VK_SHADER_STAGE_VERTEX_BIT)
* @param[in] relative path to the shader code (e.g. "../../../../../shaders/vert.spv")