mirror of
				https://github.com/PancakeTAS/lsfg-vk.git
				synced 2025-10-30 07:01:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include "vk/core/buffer.hpp"
 | |
| 
 | |
| #include <unordered_map>
 | |
| #include <cstdint>
 | |
| 
 | |
| namespace VK::Pool {
 | |
| 
 | |
|     ///
 | |
|     /// Pool of initialized buffers.
 | |
|     ///
 | |
|     class BufferPool {
 | |
|     public:
 | |
|         ///
 | |
|         /// Create a buffer pool.
 | |
|         ///
 | |
|         BufferPool() noexcept = default;
 | |
| 
 | |
|         ///
 | |
|         /// Get or create a buffer.
 | |
|         ///
 | |
|         /// @param device Vulkan device.
 | |
|         /// @param flow Flow scale
 | |
|         /// @param hdr Whether HDR is enabled
 | |
|         /// @param timestamp Timestamp of the frame
 | |
|         /// @param firstIter Whether this is the first iteration
 | |
|         /// @param firstIterS Whether this is the first iteration for the second pass
 | |
|         /// @return Preallocated buffer
 | |
|         ///
 | |
|         /// @throws VK::vulkan_error if buffer creation fails.
 | |
|         ///
 | |
|         [[nodiscard]] const Core::Buffer& getOrCreate(
 | |
|             const Core::Device& device, float flow, bool hdr,
 | |
|             float timestamp, bool firstIter, bool firstIterS);
 | |
|     private:
 | |
|         std::unordered_map<uint64_t, Core::Buffer> buffers;
 | |
|     };
 | |
| 
 | |
| }
 | 
