24 vk::ShaderModuleCreateInfo shaderModuleCreateInfo(vk::ShaderModuleCreateFlags(), shader.
size,
reinterpret_cast<const uint32_t*
>(shader.
source));
25 vk::ShaderModule shaderModule =
context->
device.createShaderModule(shaderModuleCreateInfo);
27 vk::DebugUtilsObjectNameInfoEXT debug(vk::ObjectType::eShaderModule, (uint64_t)
static_cast<VkShaderModule
>(shaderModule), shader.
name.c_str());
37 D(std::cout <<
"pipeline attribute descrp: " << descr.size() << std::endl;)
41 vk::PipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo(
42 vk::PipelineVertexInputStateCreateFlags(),
45 static_cast<uint32_t
>((descr).size()),
49 vk::PipelineInputAssemblyStateCreateInfo pipelineInputAssemblyStateCreateInfo(
50 vk::PipelineInputAssemblyStateCreateFlags(),
51 vk::PrimitiveTopology::eTriangleList,
59 vk::PipelineViewportStateCreateInfo pipelineViewportStateCreateInfo(
60 vk::PipelineViewportStateCreateFlags(),
64 vk::PipelineRasterizationStateCreateInfo pipelineRasterizationStateCreateInfo(
65 vk::PipelineRasterizationStateCreateFlags(),
68 vk::PolygonMode::eFill,
69 vk::CullModeFlagBits::eNone,
70 vk::FrontFace::eClockwise,
78 vk::PipelineMultisampleStateCreateInfo pipelineMultisampleStateCreateInfo(
79 vk::PipelineMultisampleStateCreateFlags(),
80 vk::SampleCountFlagBits::e1
86 vk::PipelineDepthStencilStateCreateInfo pipelineDepthStencilStateCreateInfo(
87 vk::PipelineDepthStencilStateCreateFlags(),
100 vk::ColorComponentFlags colorComponentFlags(vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG |
101 vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA);
102 vk::PipelineColorBlendAttachmentState pipelineColorBlendAttachmentState(
104 vk::BlendFactor::eOne,
105 vk::BlendFactor::eZero,
107 vk::BlendFactor::eOne,
108 vk::BlendFactor::eZero,
114 std::vector<vk::PipelineColorBlendAttachmentState> pipelineColorBlendAttachementArray(
colorAttachmentNb, pipelineColorBlendAttachmentState);
116 vk::PipelineColorBlendStateCreateInfo pipelineColorBlendStateCreateInfo(
117 vk::PipelineColorBlendStateCreateFlags(),
120 static_cast<uint32_t
>(pipelineColorBlendAttachementArray.size()),
121 pipelineColorBlendAttachementArray.data(),
122 { { 0.0f, 0.0f, 0.0f, 0.0f } }
130 vk::PipelineLayoutCreateInfo pipelineLayoutInfo(
131 vk::PipelineLayoutCreateFlags(),
133 &descriptorSetLayout,
136 pipelineLayout = context->device.createPipelineLayout(pipelineLayoutInfo);
139 vk::GraphicsPipelineCreateInfo graphicsPipelineCreateInfo(
140 vk::PipelineCreateFlags(),
141 pipelineShaderStageCreateInfos.size(),
142 pipelineShaderStageCreateInfos.data(),
143 &pipelineVertexInputStateCreateInfo,
144 &pipelineInputAssemblyStateCreateInfo,
146 &pipelineViewportStateCreateInfo,
147 &pipelineRasterizationStateCreateInfo,
148 &pipelineMultisampleStateCreateInfo,
149 depthTest || depthWrite ? &pipelineDepthStencilStateCreateInfo :
nullptr,
150 &pipelineColorBlendStateCreateInfo,
153 renderPass->renderPass,
157 std::array<vk::DynamicState, 2> dynamicStates = { vk::DynamicState::eViewport, vk::DynamicState::eScissor };
158 vk::PipelineDynamicStateCreateInfo dynamicInfo(
159 vk::PipelineDynamicStateCreateFlags(),
160 static_cast<uint32_t
> (dynamicStates.size()),
164 if (wrapper->isUsingDifferentViewSize() && wrapper->multiviewSetup) {
166 graphicsPipelineCreateInfo.pDynamicState = &dynamicInfo;
171 pipeline = context->device.createGraphicsPipeline(
nullptr, graphicsPipelineCreateInfo);
174 std::tie(result, pipeline) = context->device.createGraphicsPipeline(
nullptr, graphicsPipelineCreateInfo);
178 case vk::Result::eSuccess:
break;
179 case vk::Result::ePipelineCompileRequiredEXT:
181 throw std::runtime_error(
"failed to create graphics pipeline! result was ePipelineCompileRequiredEXT");
183 default:
throw std::runtime_error(
"failed to create graphics pipeline!");;
Contains the class that loads the SPIR-V shaders from files.
File that contain the VulkanContext class to manage Vulkan Instance, Physical device,...
file that contains the abstract class for common code between the two pipelines (blending and warping...
file that contains the class that manage the renderPass containing the synthesis and blending steps
file that contains the VulkanWrapper class that manages the classes related to Vulkan code and ease t...
Class that represents SPIR-V shader.
std::unique_ptr< BuffersController > bufferController
void updateBuffer(uint32_t currentImage, int view)
void createPipeline(std::vector< vk::PipelineShaderStageCreateInfo > &arr)
VulkanRenderPass * renderPass
vk::ShaderModule createShaderModule(const Shader &shader)
uint32_t getIndexNumber()
void updateAllBuffer(uint32_t currentImage, int view)
void cmdBufferBindBuffer(vk::CommandBuffer &cmdBuffer, int index, InputProvider::StreamFrameInfo &frameInfo, int view)