Skip to content
Snippets Groups Projects
Verified Commit ce188d2a authored by Tobias Frisch's avatar Tobias Frisch
Browse files

[#96] Completed doxygen comments for shader compiler module

parent 7d3d0d2a
No related branches found
No related tags found
1 merge request!97Resolve "Dokumentation vervollständigen"
Pipeline #27263 passed
......@@ -14,25 +14,63 @@ namespace vkcv::shader {
* A module to use runtime shader compilation.
* @{
*/
/**
* An event function type to react on shader compilation.
*/
typedef typename event_function<ShaderStage, const std::filesystem::path&>::type ShaderCompiledFunction;
/**
* An abstract class to handle runtime shader compilation.
*/
class Compiler {
private:
protected:
/**
* A map containing macros for shader compilation.
*/
std::unordered_map<std::string, std::string> m_defines;
public:
/**
* Compile a shader from source for a target stage with a custom shader
* include path and an event function called if the compilation completes.
* @param[in] shaderStage Shader pipeline stage
* @param[in] shaderSource Source of shader
* @param[in] compiled Shader compilation event
* @param[in] includePath Include path for shaders
* @return Result if the compilation succeeds
*/
virtual bool compileSource(ShaderStage shaderStage, const char* shaderSource,
const ShaderCompiledFunction& compiled,
const std::filesystem::path& includePath) = 0;
/**
* Compile a shader from a specific file path for a target stage with
* a custom shader include path and an event function called if the
* compilation completes.
* @param[in] shaderStage Shader pipeline stage
* @param[in] shaderPath Filepath of shader
* @param[in] compiled Shader compilation event
* @param[in] includePath Include path for shaders
* @param[in] update Flag to update shaders during runtime
*/
virtual void compile(ShaderStage shaderStage, const std::filesystem::path& shaderPath,
const ShaderCompiledFunction& compiled,
const std::filesystem::path& includePath, bool update) = 0;
/**
* Return the definition value of a macro for shader compilation.
* @param[in] name Macro definition name
* @return Macro definition value
*/
std::string getDefine(const std::string& name) const;
/**
* Set a macro for shader compilation.
* @param[in] name Macro definition name
* @param[in] value Macro definition value
*/
void setDefine(const std::string& name, const std::string& value);
};
......
......@@ -11,24 +11,61 @@ namespace vkcv::shader {
* @addtogroup vkcv_shader
* @{
*/
/**
* A class to handle GLSL runtime shader compilation.
*/
class GLSLCompiler : public Compiler {
private:
public:
/**
* The constructor of a runtime GLSL shader compiler instance.
*/
GLSLCompiler();
/**
* The copy-constructor of a runtime GLSL shader compiler instance.
* @param other Other instance of a GLSL shader compiler instance
*/
GLSLCompiler(const GLSLCompiler& other);
GLSLCompiler(GLSLCompiler&& other) = default;
/**
* The destructor of a runtime GLSL shader compiler instance.
*/
~GLSLCompiler();
/**
* The copy-operator of a runtime GLSL shader compiler instance.
* @param other Other instance of a GLSL shader compiler instance
* @return Reference to this instance
*/
GLSLCompiler& operator=(const GLSLCompiler& other);
GLSLCompiler& operator=(GLSLCompiler&& other) = default;
/**
* Compile a GLSL shader from source for a target stage with a custom shader
* include path and an event function called if the compilation completes.
* @param[in] shaderStage Shader pipeline stage
* @param[in] shaderSource Source of shader
* @param[in] compiled Shader compilation event
* @param[in] includePath Include path for shaders
* @return Result if the compilation succeeds
*/
bool compileSource(ShaderStage shaderStage, const char* shaderSource,
const ShaderCompiledFunction& compiled,
const std::filesystem::path& includePath);
const std::filesystem::path& includePath) override;
/**
* Compile a GLSL shader from a specific file path for a target stage with
* a custom shader include path and an event function called if the
* compilation completes.
* @param[in] shaderStage Shader pipeline stage
* @param[in] shaderPath Filepath of shader
* @param[in] compiled Shader compilation event
* @param[in] includePath Include path for shaders
* @param[in] update Flag to update shaders during runtime
*/
void compile(ShaderStage shaderStage, const std::filesystem::path& shaderPath,
const ShaderCompiledFunction& compiled,
const std::filesystem::path& includePath = "", bool update = false) override;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment