SpiecsEngine
 
Loading...
Searching...
No Matches

◆ VulkanIndirectMeshPipelineNV()

Spices::VulkanIndirectMeshPipelineNV::VulkanIndirectMeshPipelineNV ( VulkanState & vulkanState,
const std::string & pipelineName,
const std::string & materialName,
const std::vector< VkPipeline > & pipelineRef,
const PipelineConfigInfo & config )

Constructor Function. Create VkPipeline.

Parameters
[in]vulkanStateThe global VulkanState.
[in]pipelineNameThe Pipeline name.
[in]materialNameThe Reference Material name.
[in]pipelineRefThe pipeline Reference.
[in]configPipelineConfigInfo.

Receive PipelineLayout from parameter.

Shader groups. We use pipeline reference here, so not need create shader group. Pass any group to create info will be fine.

Instance a VkGraphicsPipelineShaderGroupsCreateInfoNV.

Instance a VkGraphicsPipelineCreateInfo. Only pRasterizationState must be setted in pipeline reference.

Create Pipeline.

Receive PipelineLayout from parameter.

Shader groups. We use pipeline reference here, so not need create shader group. Pass any group to create info will be fine.

Instance a VkGraphicsPipelineShaderGroupsCreateInfoNV.

Instance a VkGraphicsPipelineCreateInfo. Only pRasterizationState must be setted in pipeline reference.

Create Pipeline.

Definition at line 558 of file VulkanPipeline.cpp.

565 : VulkanPipeline(vulkanState)
566 {
568
572 m_PipelineLayout = config.pipelineLayout;
573
579 const auto material = ResourcePool<Material>::Load<Material>(materialName, materialName);
580
581 std::stringstream ss;
582 ss << "mesh" << "." << material->GetShaderPath("mesh")[0];
583
584 VkPipelineShaderStageCreateInfo stage = ResourcePool<Shader>::Load<Shader>(ss.str(), material->GetShaderPath("mesh")[0], ShaderStage::vert)->GetShaderModule()->GetShaderStageCreateInfo();
585
586
587 VkGraphicsShaderGroupCreateInfoNV group{};
588 group.sType = VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV;
589 group.stageCount = 1;
590 group.pStages = &stage;
591
595 VkGraphicsPipelineShaderGroupsCreateInfoNV groupsCreateInfo{};
596 groupsCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV;
597 groupsCreateInfo.pipelineCount = static_cast<uint32_t>(pipelineRef.size());
598 groupsCreateInfo.pPipelines = pipelineRef.data();
599 groupsCreateInfo.groupCount = 1;
600 groupsCreateInfo.pGroups = &group;
601
606 VkGraphicsPipelineCreateInfo pipelineInfo{};
607 pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
608 pipelineInfo.flags = VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV;
609 pipelineInfo.stageCount = 1;
610 pipelineInfo.pStages = &stage;
611 pipelineInfo.pVertexInputState = nullptr;
612 pipelineInfo.pInputAssemblyState = nullptr;
613 pipelineInfo.pViewportState = &config.viewportInfo;
614 pipelineInfo.pRasterizationState = &config.rasterizationInfo;
615 pipelineInfo.pMultisampleState = &config.multisampleInfo;
616 pipelineInfo.pColorBlendState = &config.colorBlendInfo;
617 pipelineInfo.pDepthStencilState = &config.depthStencilInfo;
618 pipelineInfo.pDynamicState = &config.dynamicStateInfo;
619
620 pipelineInfo.layout = m_PipelineLayout;
621 pipelineInfo.renderPass = config.renderPass->Get();
622 pipelineInfo.subpass = config.subpass;
623
624 pipelineInfo.basePipelineIndex = -1;
625 pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
626 pipelineInfo.pNext = &groupsCreateInfo;
627
631 VK_CHECK(vkCreateGraphicsPipelines(m_VulkanState.m_Device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &m_Pipeline))
632 DEBUGUTILS_SETOBJECTNAME(VK_OBJECT_TYPE_PIPELINE, reinterpret_cast<uint64_t>(m_Pipeline), m_VulkanState.m_Device, pipelineName)
633 }
#define SPICES_PROFILE_ZONE
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
Definition VulkanUtils.h:68
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.
VulkanPipeline(VulkanState &vulkanState)
Constructor Function.
VkPipeline m_Pipeline
The VkPipeline.
VkPipelineLayout m_PipelineLayout
The VkPipelineLayout.

References Spices::VulkanPipeline::VulkanPipeline().