Files
OpenVulkano/openVulkanoCpp/Vulkan/Scene/VulkanShader.hpp
2025-01-05 17:36:19 +01:00

46 lines
1.2 KiB
C++

/*
* 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 "Scene/Shader/Shader.hpp"
#include <vulkan/vulkan.hpp>
#include <vector>
namespace OpenVulkano::Vulkan
{
class Context;
class IShaderOwner;
class VulkanShader final : public IRenderResource<Scene::Shader>, public IRecordable
{
public:
vk::Device device;
std::vector<vk::ShaderModule> shaderModules; // TODO manage live time somewhere else to allow sharing of shader programs
std::vector<vk::PipelineShaderStageCreateInfo> shaderStageCreateInfo;
vk::Pipeline pipeline; // TODO pipeline and shader config should be split
std::vector<vk::DescriptorSetLayout> descriptorSetLayouts;
vk::PipelineLayout pipelineLayout;
IShaderOwner* owner = nullptr;
Context* context = nullptr;
VulkanShader(Context* context, Scene::Shader* shader, IShaderOwner* owner);
~VulkanShader() override;
void Resize();
void Record(VulkanDrawContext* context) override;
void Release() override;
private:
void BuildPipeline();
void CreatePipelineLayout();
};
}