mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-23 20:47:45 +00:00
Reuse the depth buffer in composite pass
This commit is contained in:
parent
b7a594e9d3
commit
1b73a3a540
1 changed files with 16 additions and 3 deletions
|
@ -677,7 +677,7 @@ void GameRenderer::beginPass(uint32_t imageIndex, VkCommandBuffer commandBuffer,
|
||||||
colorAttachments.push_back(attachmentInfo);
|
colorAttachments.push_back(attachmentInfo);
|
||||||
}
|
}
|
||||||
} else if (passName == "PASS_COMPOSITE_SEMITRANSPARENCY") {
|
} else if (passName == "PASS_COMPOSITE_SEMITRANSPARENCY") {
|
||||||
// normals, it seems like
|
// composite
|
||||||
{
|
{
|
||||||
VkRenderingAttachmentInfo attachmentInfo{VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO};
|
VkRenderingAttachmentInfo attachmentInfo{VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO};
|
||||||
attachmentInfo.imageView = m_compositeBuffer.imageView;
|
attachmentInfo.imageView = m_compositeBuffer.imageView;
|
||||||
|
@ -692,6 +692,17 @@ void GameRenderer::beginPass(uint32_t imageIndex, VkCommandBuffer commandBuffer,
|
||||||
|
|
||||||
colorAttachments.push_back(attachmentInfo);
|
colorAttachments.push_back(attachmentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// depth buffer for depth testing
|
||||||
|
{
|
||||||
|
VkRenderingAttachmentInfo attachmentInfo{VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO};
|
||||||
|
attachmentInfo.imageView = m_depthBuffer.imageView;
|
||||||
|
attachmentInfo.imageLayout = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL;
|
||||||
|
attachmentInfo.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||||
|
attachmentInfo.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||||
|
|
||||||
|
depthStencilAttachment = attachmentInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderingInfo.layerCount = 1;
|
renderingInfo.layerCount = 1;
|
||||||
|
@ -967,8 +978,10 @@ GameRenderer::bindPipeline(VkCommandBuffer commandBuffer, std::string_view passN
|
||||||
VkPipelineDepthStencilStateCreateInfo depthStencil = {};
|
VkPipelineDepthStencilStateCreateInfo depthStencil = {};
|
||||||
depthStencil.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
depthStencil.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
||||||
depthStencil.depthTestEnable = VK_TRUE;
|
depthStencil.depthTestEnable = VK_TRUE;
|
||||||
depthStencil.depthWriteEnable = VK_TRUE;
|
if (passName == "PASS_G_OPAQUE") {
|
||||||
depthStencil.depthCompareOp = VK_COMPARE_OP_LESS;
|
depthStencil.depthWriteEnable = VK_TRUE;
|
||||||
|
}
|
||||||
|
depthStencil.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL;
|
||||||
depthStencil.maxDepthBounds = 1.0f;
|
depthStencil.maxDepthBounds = 1.0f;
|
||||||
|
|
||||||
std::array<VkFormat, 3> colorAttachmentFormats = {VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED};
|
std::array<VkFormat, 3> colorAttachmentFormats = {VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED};
|
||||||
|
|
Loading…
Add table
Reference in a new issue