/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #pragma once #include "IRecordable.hpp" #include "Base/ICloseable.hpp" #include #include namespace OpenVulkano { namespace Scene { class Shader; } namespace Vulkan { class Context; class IShaderOwner; struct VulkanShader final : public ICloseable, public IRecordable { Scene::Shader* shader = nullptr; vk::Device device; std::vector shaderModules; // TODO manage live time somewhere else to allow sharing of shader programs std::vector shaderStageCreateInfo; vk::Pipeline pipeline; // TODO pipeline and shader config should be split std::vector descriptorSetLayouts; vk::PipelineLayout pipelineLayout; IShaderOwner* owner = nullptr; Context* context = nullptr; VulkanShader() = default; ~VulkanShader() override; void Init(Context* context, Scene::Shader* shader, IShaderOwner* owner); void Resize(); void Record(VulkanDrawContext* context) override; void Close() override; private: void BuildPipeline(); void CreatePipelineLayout(); }; } }