/* * WiVRn VR streaming * Copyright (C) 2022 Guillaume Meunier * Copyright (C) 2022 Patrick Nicolas * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include #include namespace vk { class pipeline_builder { public: vk::PipelineCreateFlags flags = {}; std::vector Stages; std::vector VertexBindingDescriptions; std::vector VertexAttributeDescriptions; std::optional InputAssemblyState; std::optional TessellationState; std::vector Viewports = {}; std::vector Scissors = {}; std::optional RasterizationState; std::optional MultisampleState; std::optional DepthStencilState; vk::PipelineColorBlendStateCreateInfo ColorBlendState; std::vector ColorBlendAttachments; std::vector DynamicStates; // Automatically filled vk::PipelineVertexInputStateCreateInfo VertexInputState; vk::PipelineViewportStateCreateInfo ViewportState; vk::PipelineDynamicStateCreateInfo DynamicState; vk::PipelineLayout layout; vk::RenderPass renderPass = {}; uint32_t subpass = {}; vk::Pipeline basePipelineHandle; int32_t basePipelineIndex = {}; operator vk::GraphicsPipelineCreateInfo() { VertexInputState.setVertexBindingDescriptions(VertexBindingDescriptions); VertexInputState.setVertexAttributeDescriptions(VertexAttributeDescriptions); ViewportState.setViewports(Viewports); ViewportState.setScissors(Scissors); ColorBlendState.setAttachments(ColorBlendAttachments); DynamicState.setDynamicStates(DynamicStates); return GraphicsPipelineCreateInfo{ .flags = flags, .stageCount = (uint32_t)Stages.size(), .pStages = Stages.data(), .pVertexInputState = &VertexInputState, .pInputAssemblyState = InputAssemblyState ? &*InputAssemblyState : nullptr, .pTessellationState = TessellationState ? &*TessellationState : nullptr, .pViewportState = &ViewportState, .pRasterizationState = RasterizationState ? &*RasterizationState : nullptr, .pMultisampleState = MultisampleState ? &*MultisampleState : nullptr, .pDepthStencilState = DepthStencilState ? &*DepthStencilState : nullptr, .pColorBlendState = &ColorBlendState, .pDynamicState = &DynamicState, .layout = layout, .renderPass = renderPass, .subpass = subpass, .basePipelineHandle = basePipelineHandle, .basePipelineIndex = basePipelineIndex, }; } }; } // namespace vk