From ce188d2a3ac25ea2979f42caca28bb30d1566003 Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Wed, 15 Sep 2021 13:12:18 +0200
Subject: [PATCH] [#96] Completed doxygen comments for shader compiler module

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 .../include/vkcv/shader/Compiler.hpp          | 48 +++++++++++++++--
 .../include/vkcv/shader/GLSLCompiler.hpp      | 51 ++++++++++++++++---
 2 files changed, 87 insertions(+), 12 deletions(-)

diff --git a/modules/shader_compiler/include/vkcv/shader/Compiler.hpp b/modules/shader_compiler/include/vkcv/shader/Compiler.hpp
index 32590e16..3ffa2516 100644
--- a/modules/shader_compiler/include/vkcv/shader/Compiler.hpp
+++ b/modules/shader_compiler/include/vkcv/shader/Compiler.hpp
@@ -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);
 	};
 
diff --git a/modules/shader_compiler/include/vkcv/shader/GLSLCompiler.hpp b/modules/shader_compiler/include/vkcv/shader/GLSLCompiler.hpp
index a50c5ae0..66e2b1fb 100644
--- a/modules/shader_compiler/include/vkcv/shader/GLSLCompiler.hpp
+++ b/modules/shader_compiler/include/vkcv/shader/GLSLCompiler.hpp
@@ -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;
-- 
GitLab