From 0770a0c3e8cb88ca0749fdbbf1c2286f3efeeef0 Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Sat, 11 Jun 2022 22:32:26 +0200
Subject: [PATCH] Added doxygen comments to multiple modules

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 include/vkcv/Downsampler.hpp                  |  5 +-
 modules/algorithm/README.md                   | 15 ++++
 .../vkcv/algorithm/SinglePassDownsampler.hpp  | 55 +++++++++---
 .../vkcv/algorithm/SinglePassDownsampler.cpp  | 15 ++++
 .../vkcv/upscaling/BilinearUpscaling.hpp      |  2 +
 .../include/vkcv/upscaling/FSRUpscaling.hpp   |  8 ++
 .../include/vkcv/upscaling/NISUpscaling.hpp   | 88 +++++++++++++++++++
 .../include/vkcv/upscaling/Upscaling.hpp      |  2 +
 8 files changed, 174 insertions(+), 16 deletions(-)
 create mode 100644 modules/algorithm/README.md

diff --git a/include/vkcv/Downsampler.hpp b/include/vkcv/Downsampler.hpp
index d833f58e..b288f358 100644
--- a/include/vkcv/Downsampler.hpp
+++ b/include/vkcv/Downsampler.hpp
@@ -19,6 +19,7 @@ namespace vkcv {
 	public:
 		/**
          * Constructor to create a downsampler instance.
+         *
          * @param[in,out] core Reference to a Core instance
          */
 		explicit Downsampler(Core& core);
@@ -29,8 +30,8 @@ namespace vkcv {
 		 * Record the commands of the given downsampler instance to
          * scale the image down on its own mip levels.
 		 *
-		 * @param[in] cmdStream
-		 * @param[in] image
+		 * @param[in] cmdStream Command stream handle
+		 * @param[in] image Image handle
 		 */
 		virtual void recordDownsampling(const CommandStreamHandle& cmdStream,
 										const ImageHandle& image) = 0;
diff --git a/modules/algorithm/README.md b/modules/algorithm/README.md
new file mode 100644
index 00000000..b01dbbef
--- /dev/null
+++ b/modules/algorithm/README.md
@@ -0,0 +1,15 @@
+# Algorithm
+
+A VkCV module to use different optimized algorithms
+
+## Build
+
+### Dependencies (required):
+
+| Name of dependency                                                   | Used as submodule |
+|----------------------------------------------------------------------|---|
+| [FidelityFX-SPD](https://github.com/GPUOpen-Effects/FidelityFX-SPD/) | ✅ |
+
+## Docs
+
+Here is a [link](https://vkcv.de/develop/group__vkcv__algorithm.html) to this module.
diff --git a/modules/algorithm/include/vkcv/algorithm/SinglePassDownsampler.hpp b/modules/algorithm/include/vkcv/algorithm/SinglePassDownsampler.hpp
index 0b5a71cd..02d2f8d6 100644
--- a/modules/algorithm/include/vkcv/algorithm/SinglePassDownsampler.hpp
+++ b/modules/algorithm/include/vkcv/algorithm/SinglePassDownsampler.hpp
@@ -7,40 +7,67 @@
 #include <vkcv/ShaderProgram.hpp>
 
 namespace vkcv::algorithm {
-
-#define SPD_MAX_MIP_LEVELS 12
-	
-	struct SPDConstants {
-		int mips;
-		int numWorkGroupsPerSlice;
-		int workGroupOffset[2];
-	};
 	
-	struct SPDConstantsSampler {
-		int mips;
-		int numWorkGroupsPerSlice;
-		int workGroupOffset[2];
-		float invInputSize[2];
-	};
+	/**
+	* @defgroup vkcv_algorithm Algorithm Module
+	* A module to use different optimized algorithms.
+	* @{
+	*/
 
+	/**
+	 * A class to handle downsampling via FidelityFX Single Pass Downsampler.
+	 * https://github.com/GPUOpen-Effects/FidelityFX-SPD
+	 */
 	class SinglePassDownsampler : public vkcv::Downsampler {
 	private:
+		/**
+		 * The SPD compute pipeline of the downsampler.
+		 */
 		ComputePipelineHandle m_pipeline;
 		
+		/**
+         * The descriptor set layout of the SPD pipeline.
+         */
 		DescriptorSetLayoutHandle m_descriptorSetLayout;
+		
+		/**
+		 * The vector of descriptor sets currently in use for downsampling.
+		 */
 		std::vector<DescriptorSetHandle> m_descriptorSets;
 		
+		/**
+		 * The buffer template to handle global atomic counters for SPD.
+		 */
 		Buffer<uint32_t> m_globalCounter;
 		
+		/**
+		 * The optional sampler handle to use for the downsampling.
+		 */
 		SamplerHandle m_sampler;
 		
 	public:
+		/**
+		 * Constructor to create instance for single pass downsampling.
+		 *
+		 * @param[in,out] core Reference to a Core instance
+		 * @param[in] sampler Sampler handle
+		 */
 		explicit SinglePassDownsampler(Core& core,
 									   const SamplerHandle &sampler = SamplerHandle());
 		
+		/**
+		 * Record the comands of the downsampling instance to
+		 * generate all mip levels of an input image via a
+		 * command stream.
+		 *
+		 * @param[in] cmdStream Command stream handle
+		 * @param[in] image Image handle
+		 */
 		void recordDownsampling(const CommandStreamHandle& cmdStream,
 								const ImageHandle& image) override;
 	
 	};
+	
+	/** @} */
 
 }
diff --git a/modules/algorithm/src/vkcv/algorithm/SinglePassDownsampler.cpp b/modules/algorithm/src/vkcv/algorithm/SinglePassDownsampler.cpp
index 6d55bfd7..fb078cc9 100644
--- a/modules/algorithm/src/vkcv/algorithm/SinglePassDownsampler.cpp
+++ b/modules/algorithm/src/vkcv/algorithm/SinglePassDownsampler.cpp
@@ -19,6 +19,21 @@
 
 namespace vkcv::algorithm {
 	
+	#define SPD_MAX_MIP_LEVELS 12
+	
+	struct SPDConstants {
+		int mips;
+		int numWorkGroupsPerSlice;
+		int workGroupOffset[2];
+	};
+	
+	struct SPDConstantsSampler {
+		int mips;
+		int numWorkGroupsPerSlice;
+		int workGroupOffset[2];
+		float invInputSize[2];
+	};
+	
 	static DescriptorBindings getDescriptorBindings(const SamplerHandle &sampler) {
 		DescriptorBindings descriptorBindings = {};
 		
diff --git a/modules/upscaling/include/vkcv/upscaling/BilinearUpscaling.hpp b/modules/upscaling/include/vkcv/upscaling/BilinearUpscaling.hpp
index 52569467..4f0bfea8 100644
--- a/modules/upscaling/include/vkcv/upscaling/BilinearUpscaling.hpp
+++ b/modules/upscaling/include/vkcv/upscaling/BilinearUpscaling.hpp
@@ -17,6 +17,7 @@ namespace vkcv::upscaling {
 	public:
         /**
          * Constructor to create instance for bilinear upscaling.
+         *
          * @param[in,out] core Reference to a Core instance
          */
 		explicit BilinearUpscaling(Core& core);
@@ -25,6 +26,7 @@ namespace vkcv::upscaling {
          * Record the comands of the bilinear upscaling instance to
          * scale the image of the input handle to the resolution of
          * the output image handle via bilinear interpolation.
+         *
          * @param[in] cmdStream Command stream handle to record commands
          * @param[in] input Input image handle
          * @param[in] output Output image handle
diff --git a/modules/upscaling/include/vkcv/upscaling/FSRUpscaling.hpp b/modules/upscaling/include/vkcv/upscaling/FSRUpscaling.hpp
index 04f9ea72..fd5bbd37 100644
--- a/modules/upscaling/include/vkcv/upscaling/FSRUpscaling.hpp
+++ b/modules/upscaling/include/vkcv/upscaling/FSRUpscaling.hpp
@@ -49,6 +49,7 @@ namespace vkcv::upscaling {
     /**
      * Calculates the internal resolution for actual rendering if
      * a specific mode of quality is used for upscaling with FSR.
+     *
      * @param[in] mode Mode of quality
      * @param[in] outputWidth Final resolution width
      * @param[in] outputHeight Final resolution height
@@ -62,6 +63,7 @@ namespace vkcv::upscaling {
     /**
      * Returns the matching negative lod bias to reduce artifacts
      * upscaling with FSR under a given mode of quality.
+     *
      * @param mode Mode of quality
      * @return Lod bias
      */
@@ -179,6 +181,7 @@ namespace vkcv::upscaling {
 	public:
         /**
          * Constructor to create instance for FSR upscaling.
+         *
          * @param[in,out] core Reference to a Core instance
          */
 		explicit FSRUpscaling(Core& core);
@@ -187,6 +190,7 @@ namespace vkcv::upscaling {
          * Record the comands of the FSR upscaling instance to
          * scale the image of the input handle to the resolution of
          * the output image handle via FidelityFX Super Resolution.
+         *
          * @param[in] cmdStream Command stream handle to record commands
          * @param[in] input Input image handle
          * @param[in] output Output image handle
@@ -197,6 +201,7 @@ namespace vkcv::upscaling {
 
         /**
          * Checks if HDR support is enabled and returns the status as boolean.
+         *
          * @return true if HDR is supported, otherwise false
          */
 		[[nodiscard]]
@@ -204,12 +209,14 @@ namespace vkcv::upscaling {
 
         /**
          * Changes the status of HDR support of the FSR upscaling instance.
+         *
          * @param[in] enabled New status of HDR support
          */
 		void setHdrEnabled(bool enabled);
 
         /**
          * Returns the amount of sharpness the FSR upscaling instance is using.
+         *
          * @return The amount of sharpness
          */
 		[[nodiscard]]
@@ -219,6 +226,7 @@ namespace vkcv::upscaling {
          * Changes the amount of sharpness of the FSR upscaling instance.
          * The new sharpness value is restricted by 0.0f as lower and 1.0f
          * as upper boundary.
+         *
          * @param[in] sharpness New sharpness value
          */
 		void setSharpness(float sharpness);
diff --git a/modules/upscaling/include/vkcv/upscaling/NISUpscaling.hpp b/modules/upscaling/include/vkcv/upscaling/NISUpscaling.hpp
index efab311d..9a35bfd5 100644
--- a/modules/upscaling/include/vkcv/upscaling/NISUpscaling.hpp
+++ b/modules/upscaling/include/vkcv/upscaling/NISUpscaling.hpp
@@ -6,41 +6,129 @@
 
 namespace vkcv::upscaling {
 	
+	/**
+     * @addtogroup vkcv_upscaling
+     * @{
+     */
+	
+	/**
+	 * A class to handle upscaling via NVIDIA Image Scaling.
+	 * https://github.com/NVIDIAGameWorks/NVIDIAImageScaling
+	 */
 	class NISUpscaling : public Upscaling {
 	private:
+		/**
+         * The compute pipeline of the NIS upscaling.
+         */
 		ComputePipelineHandle m_scalerPipeline;
 		
+		/**
+		 * The descriptor set layout of the upscaling pipeline.
+		 */
 		DescriptorSetLayoutHandle m_scalerDescriptorSetLayout;
+		
+		/**
+		 * The descriptor set for the upscaling pipeline.
+		 */
 		DescriptorSetHandle m_scalerDescriptorSet;
 		
+		/**
+		 * The buffer template to handle NIS constants for
+         * the upscaling pipeline.
+		 */
 		Buffer<uint8_t> m_scalerConstants;
+		
+		/**
+		 * The sampler handle to use for accessing the images
+         * in the NIS upscaling process.
+		 */
 		SamplerHandle m_sampler;
+		
+		/**
+		 * The image handle to store the upscaling coefficients.
+		 */
 		ImageHandle m_coefScaleImage;
+		
+		/**
+		 * The image handle to store the USM coefficients.
+		 */
 		ImageHandle m_coefUsmImage;
 		
+		/**
+		 * The amount of pixels per block width.
+		 */
 		uint32_t m_blockWidth;
+		
+		/**
+		 *  The amount of pixels per block height.
+		 */
 		uint32_t m_blockHeight;
 		
+		/**
+		 * Current state of HDR support.
+		 */
 		bool m_hdr;
+		
+		/**
+		 * The current value of sharpness.
+		 */
 		float m_sharpness;
 		
 	public:
+		/**
+		 * Constructor to create instance for NIS upscaling.
+		 *
+		 * @param[in,out] core Reference to a Core instance
+		 */
 		explicit NISUpscaling(Core &core);
 		
+		/**
+         * Record the comands of the NIS upscaling instance to
+         * scale the image of the input handle to the resolution of
+         * the output image handle via NVIDIA Image Scaling.
+         *
+         * @param[in] cmdStream Command stream handle to record commands
+         * @param[in] input Input image handle
+         * @param[in] output Output image handle
+         */
 		void recordUpscaling(const CommandStreamHandle &cmdStream,
 							 const ImageHandle &input,
 							 const ImageHandle &output) override;
 		
+		/**
+         * Checks if HDR support is enabled and returns the status as boolean.
+         *
+         * @return true if HDR is supported, otherwise false
+         */
 		[[nodiscard]]
 		bool isHdrEnabled() const;
 		
+		/**
+         * Changes the status of HDR support of the NIS upscaling instance.
+         *
+         * @param[in] enabled New status of HDR support
+         */
 		void setHdrEnabled(bool enabled);
 		
+		/**
+         * Returns the amount of sharpness the NIS upscaling instance is using.
+         *
+         * @return The amount of sharpness
+         */
 		[[nodiscard]]
 		float getSharpness() const;
 		
+		/**
+         * Changes the amount of sharpness of the NIS upscaling instance.
+         * The new sharpness value is restricted by 0.0f as lower and 1.0f
+         * as upper boundary.
+         *
+         * @param[in] sharpness New sharpness value
+         */
 		void setSharpness(float sharpness);
 		
 	};
 	
+	/** @} */
+	
 }
diff --git a/modules/upscaling/include/vkcv/upscaling/Upscaling.hpp b/modules/upscaling/include/vkcv/upscaling/Upscaling.hpp
index 12ba21a8..4d04746f 100644
--- a/modules/upscaling/include/vkcv/upscaling/Upscaling.hpp
+++ b/modules/upscaling/include/vkcv/upscaling/Upscaling.hpp
@@ -24,6 +24,7 @@ namespace vkcv::upscaling {
 	public:
         /**
          * Constructor to create an upscaling instance.
+         *
          * @param[in,out] core Reference to a Core instance
          */
 		explicit Upscaling(Core& core);
@@ -34,6 +35,7 @@ namespace vkcv::upscaling {
          * Record the comands of the given upscaling instance to
          * scale the image of the input handle to the resolution of
          * the output image handle.
+         *
          * @param[in] cmdStream Command stream handle to record commands
          * @param[in] input Input image handle
          * @param[in] output Output image handle
-- 
GitLab