mirror of
				https://github.com/PancakeTAS/lsfg-vk.git
				synced 2025-10-30 07:01:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include "vk/core/sampler.hpp"
 | |
| 
 | |
| #include <vulkan/vulkan_core.h>
 | |
| 
 | |
| #include <unordered_map>
 | |
| #include <cstdint>
 | |
| 
 | |
| namespace VK::Pool {
 | |
| 
 | |
|     ///
 | |
|     /// Pool of initialized samplers.
 | |
|     ///
 | |
|     class SamplerPool {
 | |
|     public:
 | |
|         ///
 | |
|         /// Create a sampler pool.
 | |
|         ///
 | |
|         SamplerPool() noexcept = default;
 | |
| 
 | |
|         ///
 | |
|         /// Get or create a sampler.
 | |
|         ///
 | |
|         /// @param device Vulkan device.
 | |
|         /// @param type Address mode
 | |
|         /// @param compare Compare operation
 | |
|         /// @param white Whether to use a white border color
 | |
|         /// @return Preallocated sampler
 | |
|         ///
 | |
|         /// @throws VK::vulkan_error if sampler creation fails.
 | |
|         ///
 | |
|         [[nodiscard]] const Core::Sampler& getOrCreate(
 | |
|             const Core::Device& device,
 | |
|             VkSamplerAddressMode type = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
 | |
|             VkCompareOp compare = VK_COMPARE_OP_NEVER,
 | |
|             bool white = false);
 | |
|     private:
 | |
|         std::unordered_map<uint64_t, Core::Sampler> samplers;
 | |
|     };
 | |
| 
 | |
| }
 | 
