Skip to content

Commit

Permalink
Make use of STORE_OP_NONE when appropriate.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Mar 26, 2024
1 parent ac540cf commit 6540e09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion renderer/render_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ void RenderGraph::build_render_pass_info()
if (preserve_depth)
{
// Have to store here, or the attachment becomes undefined in future passes.
rp.op_flags |= Vulkan::RENDER_PASS_OP_STORE_DEPTH_STENCIL_BIT;
rp.op_flags |= Vulkan::RENDER_PASS_OP_PRESERVE_DEPTH_STENCIL_BIT;
}
}

Expand Down
10 changes: 10 additions & 0 deletions vulkan/render_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,17 @@ RenderPass::RenderPass(Hash hash, Device *device_, const RenderPassInfo &info)
ds_load_op = VK_ATTACHMENT_LOAD_OP_LOAD;

if (info.op_flags & RENDER_PASS_OP_STORE_DEPTH_STENCIL_BIT)
{
ds_store_op = VK_ATTACHMENT_STORE_OP_STORE;
}
else if (info.op_flags & RENDER_PASS_OP_PRESERVE_DEPTH_STENCIL_BIT)
{
ds_store_op = device->get_device_features().device_api_core_version >= VK_API_VERSION_1_3 ?
VK_ATTACHMENT_STORE_OP_NONE : VK_ATTACHMENT_STORE_OP_STORE;

if (ds_load_op != VK_ATTACHMENT_LOAD_OP_LOAD)
ds_store_op = VK_ATTACHMENT_STORE_OP_STORE;
}

bool ds_read_only = (info.op_flags & RENDER_PASS_OP_DEPTH_STENCIL_READ_ONLY_BIT) != 0;
VkImageLayout depth_stencil_layout = VK_IMAGE_LAYOUT_UNDEFINED;
Expand Down
3 changes: 2 additions & 1 deletion vulkan/render_pass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ enum RenderPassOp
RENDER_PASS_OP_STORE_DEPTH_STENCIL_BIT = 1 << 2,
RENDER_PASS_OP_DEPTH_STENCIL_READ_ONLY_BIT = 1 << 3,
RENDER_PASS_OP_ENABLE_TRANSIENT_STORE_BIT = 1 << 4,
RENDER_PASS_OP_ENABLE_TRANSIENT_LOAD_BIT = 1 << 5
RENDER_PASS_OP_ENABLE_TRANSIENT_LOAD_BIT = 1 << 5,
RENDER_PASS_OP_PRESERVE_DEPTH_STENCIL_BIT = 1 << 6
};
using RenderPassOpFlags = uint32_t;

Expand Down

0 comments on commit 6540e09

Please sign in to comment.