#pragma once

#include "forward.hpp"

namespace render::vk {

struct Subpass {
    VkShaderModule vsShader;
    VkShaderModule gsShader = NULL;
    VkShaderModule fsShader;
    VkPipelineLayout layout;
    VkPipeline pipeline;
};

class Pipeline final {
public:
    Pipeline(VkDevice, const PhysicalDeviceInfo&, const renderOptions&);
    ~Pipeline();


    // Universe renderpass
    constexpr VkRenderPass getRenderPass() const { return renderPass; }
    // Voxels (world & entity) passes descriptor set
    constexpr VkDescriptorSetLayout getVoxelDescriptorSet() const { return voxelDescriptorSet; }
    constexpr const Subpass& getWorldPass() const { return worldPass; }
    constexpr const Subpass &getEntitiesPass() const { return worldPass; }
    constexpr VkDescriptorSetLayout getIndicDescriptorSet() const { return indicDescriptorSet; }
    constexpr const Subpass &getIndicPass() const { return indicPass; }
    constexpr const Subpass& getTransparentWorldPass() const { return transparentWorldPass; }
    constexpr VkDescriptorSetLayout getSkyDescriptorSet() const { return skyDescriptorSet; }
    constexpr const Subpass& getSkyPass() const { return skyPass; }

    constexpr VkRenderPass getUIRenderPass() const { return uiRenderPass; }

private:
    VkDevice device;

    VkRenderPass renderPass;

    VkDescriptorSetLayout voxelDescriptorSet;
    VkDescriptorSetLayout indicDescriptorSet;
    VkDescriptorSetLayout skyDescriptorSet;

    Subpass worldPass;
    Subpass indicPass;
    Subpass transparentWorldPass;
    Subpass skyPass;

    VkRenderPass uiRenderPass;
};
}