mirror of
				https://github.com/PancakeTAS/lsfg-vk.git
				synced 2025-10-30 07:01:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef COMMANDPOOL_HPP
 | 
						|
#define COMMANDPOOL_HPP
 | 
						|
 | 
						|
#include <vulkan/vulkan_core.h>
 | 
						|
 | 
						|
#include <memory>
 | 
						|
 | 
						|
namespace Mini {
 | 
						|
 | 
						|
    ///
 | 
						|
    /// C++ wrapper class for a Vulkan command pool.
 | 
						|
    ///
 | 
						|
    /// This class manages the lifetime of a Vulkan command pool.
 | 
						|
    ///
 | 
						|
    class CommandPool {
 | 
						|
    public:
 | 
						|
        CommandPool() noexcept = default;
 | 
						|
 | 
						|
        ///
 | 
						|
        /// Create the command pool.
 | 
						|
        ///
 | 
						|
        /// @param device Vulkan device
 | 
						|
        /// @param graphicsFamilyIdx Index of the graphics queue family
 | 
						|
        ///
 | 
						|
        /// @throws LSFG::vulkan_error if object creation fails.
 | 
						|
        ///
 | 
						|
        CommandPool(VkDevice device, uint32_t graphicsFamilyIdx);
 | 
						|
 | 
						|
        /// Get the Vulkan handle.
 | 
						|
        [[nodiscard]] auto handle() const { return *this->commandPool; }
 | 
						|
 | 
						|
        /// Trivially copyable, moveable and destructible
 | 
						|
        CommandPool(const CommandPool&) noexcept = default;
 | 
						|
        CommandPool& operator=(const CommandPool&) noexcept = default;
 | 
						|
        CommandPool(CommandPool&&) noexcept = default;
 | 
						|
        CommandPool& operator=(CommandPool&&) noexcept = default;
 | 
						|
        ~CommandPool() = default;
 | 
						|
    private:
 | 
						|
        std::shared_ptr<VkCommandPool> commandPool;
 | 
						|
    };
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
#endif // COMMANDPOOL_HPP
 |