完成单渲染管线创建
parent
7b1d83753f
commit
a0e1319aef
|
@ -133,6 +133,8 @@ void HelloTriangleApplication::cleanup(GLFWwindow* window) {
|
||||||
|
|
||||||
std::cout << "\nstart to destroy resource\n" << std::endl;
|
std::cout << "\nstart to destroy resource\n" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
vkDestroyPipeline(device, graphicsPipeline, nullptr);
|
||||||
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
|
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
|
||||||
vkDestroyRenderPass(device, renderPass, nullptr);
|
vkDestroyRenderPass(device, renderPass, nullptr);
|
||||||
|
|
||||||
|
@ -791,6 +793,33 @@ void HelloTriangleApplication::createGraphicPipeline()
|
||||||
throw std::runtime_error("failed to create pipeline Layout in createGraphicPipeline");
|
throw std::runtime_error("failed to create pipeline Layout in createGraphicPipeline");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VkGraphicsPipelineCreateInfo pipelineInfo{};
|
||||||
|
pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
|
pipelineInfo.stageCount = 2;
|
||||||
|
pipelineInfo.pStages = shaderStages;
|
||||||
|
|
||||||
|
pipelineInfo.pVertexInputState = &vertexInputInfo;
|
||||||
|
pipelineInfo.pInputAssemblyState = &inputAsseblyState;
|
||||||
|
pipelineInfo.pViewportState = &viewportState;
|
||||||
|
pipelineInfo.pRasterizationState = &rasterizer;
|
||||||
|
pipelineInfo.pMultisampleState = &multisampling;
|
||||||
|
pipelineInfo.pDepthStencilState = nullptr;
|
||||||
|
pipelineInfo.pColorBlendState = &colorBlendState;
|
||||||
|
pipelineInfo.pDynamicState = &dynamicState;
|
||||||
|
//
|
||||||
|
pipelineInfo.layout = pipelineLayout;
|
||||||
|
pipelineInfo.renderPass = renderPass;
|
||||||
|
pipelineInfo.subpass = 0;
|
||||||
|
|
||||||
|
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
|
||||||
|
pipelineInfo.basePipelineIndex = -1;
|
||||||
|
|
||||||
|
|
||||||
|
if (vkCreateGraphicsPipelines(device,VK_NULL_HANDLE,1,&pipelineInfo,nullptr,&graphicsPipeline) != VK_SUCCESS)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("failed to create graphics pipeline in createGraphicPipeline");
|
||||||
|
}
|
||||||
|
|
||||||
// 管道创建完成后销毁着色器模块
|
// 管道创建完成后销毁着色器模块
|
||||||
vkDestroyShaderModule(device, fragShaderModule, nullptr);
|
vkDestroyShaderModule(device, fragShaderModule, nullptr);
|
||||||
vkDestroyShaderModule(device, vertShaderModule, nullptr);
|
vkDestroyShaderModule(device, vertShaderModule, nullptr);
|
||||||
|
|
|
@ -66,6 +66,8 @@ private:
|
||||||
VkRenderPass renderPass;
|
VkRenderPass renderPass;
|
||||||
VkPipelineLayout pipelineLayout;
|
VkPipelineLayout pipelineLayout;
|
||||||
|
|
||||||
|
VkPipeline graphicsPipeline;
|
||||||
|
|
||||||
struct QueueFamilyIndices
|
struct QueueFamilyIndices
|
||||||
{
|
{
|
||||||
std::optional<uint32_t> graphicsFamily;
|
std::optional<uint32_t> graphicsFamily;
|
||||||
|
|
Loading…
Reference in New Issue