mirror of
				https://github.com/PancakeTAS/lsfg-vk.git
				synced 2025-10-30 07:01:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef SHADERPOOL_HPP
 | 
						|
#define SHADERPOOL_HPP
 | 
						|
 | 
						|
#include "core/device.hpp"
 | 
						|
#include "core/shadermodule.hpp"
 | 
						|
#include "pool/extract.hpp"
 | 
						|
 | 
						|
#include <string>
 | 
						|
#include <unordered_map>
 | 
						|
 | 
						|
namespace LSFG::Pool {
 | 
						|
 | 
						|
    ///
 | 
						|
    /// Shader pool for each Vulkan device.
 | 
						|
    ///
 | 
						|
    class ShaderPool {
 | 
						|
    public:
 | 
						|
        ShaderPool() noexcept = default;
 | 
						|
 | 
						|
        ///
 | 
						|
        /// Create the shader pool.
 | 
						|
        ///
 | 
						|
        /// @param path Path to the shader dll
 | 
						|
        ///
 | 
						|
        /// @throws std::runtime_error if the shader pool cannot be created.
 | 
						|
        ///
 | 
						|
        ShaderPool(const std::string& path) : extractor(path) {}
 | 
						|
 | 
						|
        ///
 | 
						|
        /// Retrieve a shader module by name or create it.
 | 
						|
        ///
 | 
						|
        /// @param device Vulkan device
 | 
						|
        /// @param name Name of the shader module
 | 
						|
        /// @param types Descriptor types for the shader module
 | 
						|
        /// @return Shader module or empty
 | 
						|
        ///
 | 
						|
        /// @throws LSFG::vulkan_error if the shader module cannot be created.
 | 
						|
        ///
 | 
						|
        Core::ShaderModule getShader(
 | 
						|
            const Core::Device& device, const std::string& name,
 | 
						|
            const std::vector<std::pair<size_t, VkDescriptorType>>& types);
 | 
						|
    private:
 | 
						|
        Extractor extractor;
 | 
						|
        std::unordered_map<std::string, Core::ShaderModule> shaders;
 | 
						|
    };
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
#endif // SHADERPOOL_HPP
 |