Constructor Function. Create VkPipeline.
Receive PipelineLayout from parameter.
Instance a VkGraphicsPipelineShaderGroupsCreateInfoNV.
Instance a VkPipelineVertexInputStateCreateInfo.
Instance a VkGraphicsPipelineCreateInfo. Only pRasterizationState must be setted in pipeline reference.
Create Pipeline.
Receive PipelineLayout from parameter.
Instance a VkGraphicsPipelineShaderGroupsCreateInfoNV.
Instance a VkPipelineVertexInputStateCreateInfo.
Instance a VkGraphicsPipelineCreateInfo. Only pRasterizationState must be setted in pipeline reference.
Create Pipeline.
477 {
479
484
490 const auto material = ResourcePool<Material>::Load<Material>(materialName, materialName);
491
492 std::stringstream ss;
493 ss << "vert" << "." << material->GetShaderPath("vert")[0];
494
495 VkPipelineShaderStageCreateInfo stage = ResourcePool<Shader>::Load<Shader>(ss.str(), material->GetShaderPath(
"vert")[0],
ShaderStage::vert)->GetShaderModule()->GetShaderStageCreateInfo();
496
497 VkGraphicsShaderGroupCreateInfoNV group{};
498 group.sType = VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV;
499 group.stageCount = 1;
500 group.pStages = &stage;
501
505 VkGraphicsPipelineShaderGroupsCreateInfoNV groupsCreateInfo{};
506 groupsCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV;
507 groupsCreateInfo.pipelineCount = static_cast<uint32_t>(pipelineRef.size());
508 groupsCreateInfo.pPipelines = pipelineRef.data();
509 groupsCreateInfo.groupCount = 1;
510 groupsCreateInfo.pGroups = &group;
511
512 auto& bindingDescriptions = config.bindingDescriptions;
513 auto& attributeDescriptions = config.attributeDescriptions;
514
518 VkPipelineVertexInputStateCreateInfo vertexInputInfo{};
519 vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
520 vertexInputInfo.vertexAttributeDescriptionCount = static_cast<uint32_t>(attributeDescriptions.size());
521 vertexInputInfo.vertexBindingDescriptionCount = static_cast<uint32_t>(bindingDescriptions.size());
522 vertexInputInfo.pVertexAttributeDescriptions = attributeDescriptions.data();
523 vertexInputInfo.pVertexBindingDescriptions = bindingDescriptions.data();
524
529 VkGraphicsPipelineCreateInfo pipelineInfo{};
530 pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
531 pipelineInfo.flags = VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV;
532 pipelineInfo.stageCount = 1;
533 pipelineInfo.pStages = &stage;
534 pipelineInfo.pVertexInputState = &vertexInputInfo;
535 pipelineInfo.pInputAssemblyState = &config.inputAssemblyInfo;
536 pipelineInfo.pViewportState = &config.viewportInfo;
537 pipelineInfo.pRasterizationState = &config.rasterizationInfo;
538 pipelineInfo.pMultisampleState = &config.multisampleInfo;
539 pipelineInfo.pColorBlendState = &config.colorBlendInfo;
540 pipelineInfo.pDepthStencilState = &config.depthStencilInfo;
541 pipelineInfo.pDynamicState = &config.dynamicStateInfo;
542
544 pipelineInfo.renderPass = config.renderPass->Get();
545 pipelineInfo.subpass = config.subpass;
546
547 pipelineInfo.basePipelineIndex = -1;
548 pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
549 pipelineInfo.pNext = &groupsCreateInfo;
550
556 }
#define SPICES_PROFILE_ZONE
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.
VulkanPipeline(VulkanState &vulkanState)
Constructor Function.
VkPipeline m_Pipeline
The VkPipeline.
VkPipelineLayout m_PipelineLayout
The VkPipelineLayout.