修正pipeline初始化所有未设置正确的变量
This commit is contained in:
parent
898d5902e1
commit
9a75f75642
@ -30,6 +30,8 @@ PipelineCreater::PipelineCreater(Device *dev)
|
||||
scissor.extent = extent;
|
||||
|
||||
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
||||
viewportState.pNext = nullptr;
|
||||
viewportState.flags = 0;
|
||||
viewportState.viewportCount = 1;
|
||||
viewportState.pViewports = &viewport;
|
||||
viewportState.scissorCount = 1;
|
||||
@ -67,6 +69,9 @@ PipelineCreater::PipelineCreater(Device *dev)
|
||||
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
rasterizer.depthBiasEnable = VK_FALSE;
|
||||
rasterizer.depthBiasConstantFactor = 0;
|
||||
rasterizer.depthBiasClamp = 0;
|
||||
rasterizer.depthBiasSlopeFactor = 0;
|
||||
rasterizer.lineWidth = 1.0f;
|
||||
|
||||
pipelineInfo.pRasterizationState = &rasterizer;
|
||||
@ -85,8 +90,16 @@ PipelineCreater::PipelineCreater(Device *dev)
|
||||
|
||||
colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
colorBlendAttachment.blendEnable = VK_FALSE;
|
||||
colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
|
||||
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
|
||||
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_ZERO;
|
||||
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ZERO;
|
||||
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
|
||||
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
|
||||
|
||||
colorBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
||||
colorBlending.pNext = nullptr;
|
||||
colorBlending.flags = 0;
|
||||
colorBlending.logicOpEnable = VK_FALSE;
|
||||
colorBlending.logicOp = VK_LOGIC_OP_COPY;
|
||||
colorBlending.attachmentCount = 1;
|
||||
@ -106,7 +119,7 @@ PipelineCreater::PipelineCreater(Device *dev)
|
||||
dynamicState.dynamicStateCount = 0;
|
||||
|
||||
pipelineInfo.pDynamicState=&dynamicState;
|
||||
|
||||
|
||||
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
|
||||
pipelineInfo.basePipelineIndex = 0;
|
||||
}
|
||||
@ -173,7 +186,7 @@ Pipeline *PipelineCreater::Create()
|
||||
{
|
||||
VkPipeline graphicsPipeline;
|
||||
|
||||
if (vkCreateGraphicsPipelines(device, cache, 1, &pipelineInfo, nullptr, &graphicsPipeline) != VK_SUCCESS)
|
||||
if (vkCreateGraphicsPipelines(device, cache, 1, &pipelineInfo, nullptr, &graphicsPipeline) != VK_SUCCESS)
|
||||
return(nullptr);
|
||||
|
||||
return(new Pipeline(device,graphicsPipeline));
|
||||
|
Loading…
x
Reference in New Issue
Block a user