lsfg-vk/lsfg-vk-gen/include/pool/shaderpool.hpp
PancakeTAS ccf71234c1
get rid of d3d11 device
hopefully fixing steam deck compat while also not breaking anything
2025-07-04 23:32:01 +02:00

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