#ifndef SHADERMODULE_HPP #define SHADERMODULE_HPP #include "device.hpp" #include #include #include #include #include namespace LSFG::Core { /// /// C++ wrapper class for a Vulkan shader module. /// /// This class manages the lifetime of a Vulkan shader module. /// class ShaderModule { public: ShaderModule() noexcept = default; /// /// Create the shader module. /// /// @param device Vulkan device /// @param path Path to the shader file. /// @param descriptorTypes Descriptor types used in the shader. /// /// @throws std::system_error if the shader file cannot be opened or read. /// @throws LSFG::vulkan_error if object creation fails. /// ShaderModule(const Device& device, const std::string& path, const std::vector>& descriptorTypes); /// Get the Vulkan handle. [[nodiscard]] auto handle() const { return *this->shaderModule; } /// Get the descriptor set layout. [[nodiscard]] auto getLayout() const { return *this->descriptorSetLayout; } /// Trivially copyable, moveable and destructible ShaderModule(const ShaderModule&) noexcept = default; ShaderModule& operator=(const ShaderModule&) noexcept = default; ShaderModule(ShaderModule&&) noexcept = default; ShaderModule& operator=(ShaderModule&&) noexcept = default; ~ShaderModule() = default; private: std::shared_ptr shaderModule; std::shared_ptr descriptorSetLayout; }; } #endif // SHADERMODULE_HPP