From 4dd24090c29f36ad631964d3e7ad75ad9efd9dfa Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Tue, 26 Apr 2022 16:44:26 +0200
Subject: [PATCH] Adjusted doxygen comments of buffer and buffer manager

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 include/vkcv/Buffer.hpp        | 84 ++++++++++++++++++++++++++++------
 include/vkcv/BufferManager.hpp | 69 ++++++++++++++++------------
 2 files changed, 108 insertions(+), 45 deletions(-)

diff --git a/include/vkcv/Buffer.hpp b/include/vkcv/Buffer.hpp
index f4c57c1e..61d4a97b 100644
--- a/include/vkcv/Buffer.hpp
+++ b/include/vkcv/Buffer.hpp
@@ -20,6 +20,8 @@ namespace vkcv {
 		Buffer() = delete;
 		
 		/**
+		 * @brief Returns the buffers handle.
+		 *
 		 * @return The #BufferHandle to be used with the #Core
 		 */
 		[[nodiscard]]
@@ -28,6 +30,8 @@ namespace vkcv {
 		}
 		
 		/**
+		 * @brief Returns the type of the buffer.
+		 *
 		 * @return The #BufferType of the #Buffer
 		 */
 		[[nodiscard]]
@@ -36,6 +40,8 @@ namespace vkcv {
 		};
 		
 		/**
+		 * @brief Returns the count of elements in the buffer.
+		 *
 		 * @return The number of objects of type T the #Buffer holds
 		 */
 		[[nodiscard]]
@@ -44,6 +50,8 @@ namespace vkcv {
 		}
 		
 		/**
+		 * @brief Returns the size of the buffer in bytes.
+		 *
 		 * @return The size of the #Buffer in bytes
 		 */
 		[[nodiscard]]
@@ -52,6 +60,8 @@ namespace vkcv {
 		}
 
 		/**
+		 * @brief Returns the vulkan buffer handle of the buffer.
+		 *
 		 * @return The vulkan handle of the #Buffer to be used for manual vulkan commands
 		 */
         [[nodiscard]]
@@ -60,40 +70,44 @@ namespace vkcv {
         }
 
 		/**
-		 * Fill the #Buffer with data of type T
+		 * @brief Fills the #Buffer with data of type T.
 		 * 
-		 * @param data Pointer to the array of object type T
-		 * @param count The number of objects to copy from the data array
-		 * @param offset The offset into the #Buffer where the data is copied into
+		 * @param[in] data Pointer to the array of object type T
+		 * @param[in] count The number of objects to copy from the data array
+		 * @param[in] offset The offset into the #Buffer where the data is copied into
 		 */
-		void fill(const T* data, size_t count = 0, size_t offset = 0) {
+		void fill(const T* data,
+				  size_t count = 0,
+				  size_t offset = 0) {
 			 m_manager->fillBuffer(m_handle, data, count * sizeof(T), offset * sizeof(T));
 		}
 		
 		/**
-		 * Fill the #Buffer with data from a vector of type T
+		 * @brief Fills the #Buffer with data from a vector of type T.
 		 * 
 		 * @param vector Vector of type T to be copied into the #Buffer
 		 * @param offset The offset into the #Buffer where the data is copied into
 		 */
-		void fill(const std::vector<T>& vector, size_t offset = 0) {
+		void fill(const std::vector<T>& vector,
+				  size_t offset = 0) {
 			fill( static_cast<const T*>(vector.data()), static_cast<size_t>(vector.size()), offset);
 		}
 		
 		/**
-		 * Maps memory to the #Buffer and returns it
+		 * @brief Maps memory to the #Buffer and returns it.
 		 *
-		 * @param offset Offset of mapping in objects of type T
-		 * @param count Count of objects of type T that are mapped
+		 * @param[in] offset Offset of mapping in objects of type T
+		 * @param[in] count Count of objects of type T that are mapped
 		 * @return Pointer to mapped memory as type T
 		 */
 		[[nodiscard]]
-		T* map(size_t offset = 0, size_t count = 0) {
+		T* map(size_t offset = 0,
+			   size_t count = 0) {
 			return reinterpret_cast<T*>(m_manager->mapBuffer(m_handle, offset * sizeof(T), count * sizeof(T)));
 		}
 
 		/**
-		 * Unmap the #Buffer, invalidates the pointer obtained by map()
+		 * @brief Unmaps the #Buffer, invalidates the pointer obtained by map().
 		 */
 		void unmap() {
 			m_manager->unmapBuffer(m_handle);
@@ -106,7 +120,20 @@ namespace vkcv {
 		const size_t m_count;
 		const BufferMemoryType m_memoryType;
 		
-		Buffer(BufferManager* manager, BufferHandle handle, BufferType type, size_t count, BufferMemoryType memoryType) :
+		/**
+		 * @brief Constructor of the buffer object.
+		 *
+		 * @param[in,out] manager Buffer manager
+		 * @param[in] handle Buffer handle
+		 * @param[in] type Type of buffer
+		 * @param[in] count Count of elements
+		 * @param[in] memoryType Type of memory
+		 */
+		Buffer(BufferManager* manager,
+			   BufferHandle handle,
+			   BufferType type,
+			   size_t count,
+			   BufferMemoryType memoryType) :
 				m_manager(manager),
 				m_handle(handle),
 				m_type(type),
@@ -114,9 +141,36 @@ namespace vkcv {
 				m_memoryType(memoryType)
 		{}
 		
+		/**
+		 * @brief Creates a buffer object of type T with
+		 * a selected type, count of elements, memory type
+		 * and support of indirect usage.
+		 *
+		 * @param[in,out] manager Buffer manager
+		 * @param[in] type Buffer type
+		 * @param[in] count Count of elements
+		 * @param[in] memoryType Type of memory
+		 * @param[in] supportIndirect Support indirect usage
+		 * @return New buffer object
+		 */
 		[[nodiscard]]
-		static Buffer<T> create(BufferManager* manager, BufferType type, size_t count, BufferMemoryType memoryType, bool supportIndirect) {
-			return Buffer<T>(manager, manager->createBuffer(type, count * sizeof(T), memoryType, supportIndirect), type, count, memoryType);
+		static Buffer<T> create(BufferManager* manager,
+								BufferType type,
+								size_t count,
+								BufferMemoryType memoryType,
+								bool supportIndirect) {
+			return Buffer<T>(
+				manager,
+				manager->createBuffer(
+					type,
+					count * sizeof(T),
+					memoryType,
+					supportIndirect
+				),
+				type,
+				count,
+				memoryType
+			);
 		}
 		
 	};
diff --git a/include/vkcv/BufferManager.hpp b/include/vkcv/BufferManager.hpp
index 6ef6b521..6f197d12 100644
--- a/include/vkcv/BufferManager.hpp
+++ b/include/vkcv/BufferManager.hpp
@@ -68,85 +68,94 @@ namespace vkcv
 		BufferManager& operator=(const BufferManager& other) = delete;
 		
 		/**
-		 * Creates and allocates a new buffer and returns its
+		 * @brief Creates and allocates a new buffer and returns its
 		 * unique buffer handle.
 		 *
-		 * @param type Type of buffer
-		 * @param size Size of buffer in bytes
-		 * @param memoryType Type of buffers memory
+		 * @param[in] type Type of buffer
+		 * @param[in] size Size of buffer in bytes
+		 * @param[in] memoryType Type of buffers memory
+		 * @param[in] supportIndirect Support of indirect usage
 		 * @return New buffer handle
 		 */
-		BufferHandle createBuffer(BufferType type, size_t size, BufferMemoryType memoryType, bool supportIndirect);
+		BufferHandle createBuffer(BufferType type,
+								  size_t size,
+								  BufferMemoryType memoryType,
+								  bool supportIndirect);
 		
 		/**
-		 * Returns the Vulkan buffer handle of a buffer
+		 * @brief Returns the Vulkan buffer handle of a buffer
 		 * represented by a given buffer handle.
 		 *
-		 * @param handle Buffer handle
+		 * @param[in] handle Buffer handle
 		 * @return Vulkan buffer handle
 		 */
 		[[nodiscard]]
 		vk::Buffer getBuffer(const BufferHandle& handle) const;
 		
 		/**
-		 * Returns the size of a buffer represented
+		 * @brief Returns the size of a buffer represented
 		 * by a given buffer handle.
 		 *
-		 * @param handle Buffer handle
+		 * @param[in] handle Buffer handle
 		 * @return Size of the buffer
 		 */
 		[[nodiscard]]
 		size_t getBufferSize(const BufferHandle& handle) const;
 		
 		/**
-		 * Returns the Vulkan device memory handle of a buffer
+		 * @brief Returns the Vulkan device memory handle of a buffer
 		 * represented by a given buffer handle id.
 		 *
-		 * @param handle Buffer handle
+		 * @param[in] handle Buffer handle
 		 * @return Vulkan device memory handle
 		 */
 		[[nodiscard]]
 		vk::DeviceMemory getDeviceMemory(const BufferHandle& handle) const;
 		
 		/**
-		 * Fills a buffer represented by a given buffer
+		 * @brief Fills a buffer represented by a given buffer
 		 * handle with custom data.
 		 *
-		 * @param handle Buffer handle
-		 * @param data Pointer to data
-		 * @param size Size of data in bytes
-		 * @param offset Offset to fill in data in bytes
+		 * @param[in] handle Buffer handle
+		 * @param[in] data Pointer to data
+		 * @param[in] size Size of data in bytes
+		 * @param[in] offset Offset to fill in data in bytes
 		 */
-		void fillBuffer(const BufferHandle& handle, const void* data, size_t size, size_t offset);
+		void fillBuffer(const BufferHandle& handle,
+						const void* data,
+						size_t size,
+						size_t offset);
 		
 		/**
-		 * Maps memory to a buffer represented by a given
+		 * @brief Maps memory to a buffer represented by a given
 		 * buffer handle and returns it.
 		 *
-		 * @param handle Buffer handle
-		 * @param offset Offset of mapping in bytes
-		 * @param size Size of mapping in bytes
+		 * @param[in] handle Buffer handle
+		 * @param[in] offset Offset of mapping in bytes
+		 * @param[in] size Size of mapping in bytes
 		 * @return Pointer to mapped memory
 		 */
-		void* mapBuffer(const BufferHandle& handle, size_t offset, size_t size);
+		void* mapBuffer(const BufferHandle& handle,
+						size_t offset,
+						size_t size);
 		
 		/**
-		 * Unmaps memory from a buffer represented by a given
+		 * @brief Unmaps memory from a buffer represented by a given
 		 * buffer handle.
 		 *
-		 * @param handle Buffer handle
+		 * @param[in] handle Buffer handle
 		 */
 		void unmapBuffer(const BufferHandle& handle);
 		
 		/**
-		 * Record a memory barrier for a buffer, synchronizing subsequent accesses to buffer data
+		 * @brief Records a memory barrier for a buffer,
+		 * synchronizing subsequent accesses to buffer data
 		 *
-		 * @param handle BufferHandle of the buffer
-		 * @param cmdBuffer Vulkan command buffer to record the barrier into
+		 * @param[in] handle BufferHandle of the buffer
+		 * @param[in] cmdBuffer Vulkan command buffer to record the barrier into
 		*/
-		void recordBufferMemoryBarrier(
-			const BufferHandle& handle,
-			vk::CommandBuffer cmdBuffer);
+		void recordBufferMemoryBarrier(const BufferHandle& handle,
+									   vk::CommandBuffer cmdBuffer);
 	};
 	
 }
-- 
GitLab