package net.halbear.Terrain4J.EngineCore.Vulkan.Rendering.Pipeline;

import net.halbear.Terrain4J.EngineCore.Vulkan.Rendering.Shader.DescriptorSetLayout;
import net.halbear.Terrain4J.EngineCore.Vulkan.Rendering.Shader.ShaderModule;
import org.lwjgl.vulkan.VkPipelineVertexInputStateCreateInfo;
import org.lwjgl.vulkan.VkPushConstantRange;

import static org.lwjgl.vulkan.VK10.VK_FORMAT_UNDEFINED;

public class PipelineBuildInfo {
    private final int ColourFormat;
    private final ShaderModule[] ShaderModules;
    private final VkPipelineVertexInputStateCreateInfo VertexInput;
    private int DepthFormat;
    private PushConstantsRange[] PushConstRanges;
    private DescriptorSetLayout[] DescriptorSetLayouts;
    private boolean useBlend;

    public PipelineBuildInfo(ShaderModule[] shaderModules, VkPipelineVertexInputStateCreateInfo VertexInput, int ColourFormat){
        this.ColourFormat = ColourFormat;
        this.ShaderModules = shaderModules;
        this.VertexInput = VertexInput;
        DepthFormat = VK_FORMAT_UNDEFINED;
        useBlend = true;
    }

    public DescriptorSetLayout[] GetDescriptorSetLayouts(){return DescriptorSetLayouts;}

    public PipelineBuildInfo SetDescriptorSetLayouts(DescriptorSetLayout[] descriptorSetLayouts){
        this.DescriptorSetLayouts = descriptorSetLayouts;
        return this;
    }

    public boolean BlendingUsed(){
        return useBlend;
    }
    public PipelineBuildInfo BlendingIsUsed(boolean useBlend) {
        this.useBlend = useBlend;
        return this;
    }

    public PipelineBuildInfo SetDepthFormat(int DepthFormat){
        this.DepthFormat = DepthFormat;
        return this;
    }
    public PipelineBuildInfo SetPushConstantRanges(PushConstantsRange[] PushConstRanges){
        this.PushConstRanges = PushConstRanges;
        return this;
    }

    public PushConstantsRange[] GetPushConstantRanges(){return PushConstRanges;}
    public int GetDepthFormat(){return DepthFormat;}
    public int GetColourFormat(){return ColourFormat;}
    public ShaderModule[] GetShaderModules(){return ShaderModules;}
    public VkPipelineVertexInputStateCreateInfo GetVertexInputStateCreateInfo(){return VertexInput;}
}
