修正pipeline初始化所有未设置正确的变量
This commit is contained in:
@@ -30,6 +30,8 @@ PipelineCreater::PipelineCreater(Device *dev)
|
|||||||
scissor.extent = extent;
|
scissor.extent = extent;
|
||||||
|
|
||||||
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
viewportState.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
||||||
|
viewportState.pNext = nullptr;
|
||||||
|
viewportState.flags = 0;
|
||||||
viewportState.viewportCount = 1;
|
viewportState.viewportCount = 1;
|
||||||
viewportState.pViewports = &viewport;
|
viewportState.pViewports = &viewport;
|
||||||
viewportState.scissorCount = 1;
|
viewportState.scissorCount = 1;
|
||||||
@@ -67,6 +69,9 @@ PipelineCreater::PipelineCreater(Device *dev)
|
|||||||
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||||
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||||
rasterizer.depthBiasEnable = VK_FALSE;
|
rasterizer.depthBiasEnable = VK_FALSE;
|
||||||
|
rasterizer.depthBiasConstantFactor = 0;
|
||||||
|
rasterizer.depthBiasClamp = 0;
|
||||||
|
rasterizer.depthBiasSlopeFactor = 0;
|
||||||
rasterizer.lineWidth = 1.0f;
|
rasterizer.lineWidth = 1.0f;
|
||||||
|
|
||||||
pipelineInfo.pRasterizationState = &rasterizer;
|
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.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.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.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
||||||
|
colorBlending.pNext = nullptr;
|
||||||
|
colorBlending.flags = 0;
|
||||||
colorBlending.logicOpEnable = VK_FALSE;
|
colorBlending.logicOpEnable = VK_FALSE;
|
||||||
colorBlending.logicOp = VK_LOGIC_OP_COPY;
|
colorBlending.logicOp = VK_LOGIC_OP_COPY;
|
||||||
colorBlending.attachmentCount = 1;
|
colorBlending.attachmentCount = 1;
|
||||||
@@ -106,7 +119,7 @@ PipelineCreater::PipelineCreater(Device *dev)
|
|||||||
dynamicState.dynamicStateCount = 0;
|
dynamicState.dynamicStateCount = 0;
|
||||||
|
|
||||||
pipelineInfo.pDynamicState=&dynamicState;
|
pipelineInfo.pDynamicState=&dynamicState;
|
||||||
|
|
||||||
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
|
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
|
||||||
pipelineInfo.basePipelineIndex = 0;
|
pipelineInfo.basePipelineIndex = 0;
|
||||||
}
|
}
|
||||||
@@ -173,7 +186,7 @@ Pipeline *PipelineCreater::Create()
|
|||||||
{
|
{
|
||||||
VkPipeline graphicsPipeline;
|
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(nullptr);
|
||||||
|
|
||||||
return(new Pipeline(device,graphicsPipeline));
|
return(new Pipeline(device,graphicsPipeline));
|
||||||
|
Reference in New Issue
Block a user