08/22/2020
模板测试
深度模板附件已经在创建深度时候已经创建好了,现在了解如何使用模板测试画描边。首先第一个管道画原模型,另一个管道画原模型的放大版但是只有纯白色,第一个管道记录原模型的样子作为模板刻印到放大版的原模型上就完成了
//第一个管道
depthStencilState.stencilTestEnable = VK_TRUE; //开启模板测试
depthStencilState.back.compareOp = VK_COMPARE_OP_ALWAYS; //始终记录原模型的样子
depthStencilState.back.failOp = VK_STENCIL_OP_REPLACE; //设置为参考值1
depthStencilState.back.depthFailOp = VK_STENCIL_OP_REPLACE; //深度测试失败,也设置为1
depthStencilState.back.passOp = VK_STENCIL_OP_REPLACE;
depthStencilState.back.compareMask = 0xff;
depthStencilState.back.writeMask = 0xff;
depthStencilState.back.reference = 1; //参考值为1
depthStencilState.front = depthStencilState.back;
VK_CHECK_RESULT(vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipelineCI, nullptr,