summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_device.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-08-20 10:03:58 -0700
committerChad Versace <[email protected]>2015-08-20 10:25:04 -0700
commit0db3d67a1488089602f787c281b2dff888fb7acd (patch)
tree93e65da8e0f58619f4947c863633c6c6cda5a0d8 /src/vulkan/anv_device.c
parent23872191012a0b95a1ef7bcefeb6609ce595fecf (diff)
vk: Cache each render pass's number of clear ops
During vkCreateRenderPass, count the number of clear ops and store them in new members of anv_render_pass: uint32_t num_color_clear_attachments bool has_depth_clear_attachment bool has_stencil_clear_attachment Cacheing these 8 bytes (including padding) reduces the number of times that anv_cmd_buffer_clear_attachments needs to loop over the pass's attachments.
Diffstat (limited to 'src/vulkan/anv_device.c')
-rw-r--r--src/vulkan/anv_device.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index 5805ffab193..eaeae3b0a4f 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -2238,6 +2238,17 @@ VkResult anv_CreateRenderPass(
att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
// att->store_op = pCreateInfo->pAttachments[i].storeOp;
// att->stencil_store_op = pCreateInfo->pAttachments[i].stencilStoreOp;
+
+ if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
+ if (anv_format_is_color(att->format)) {
+ ++pass->num_color_clear_attachments;
+ } else if (att->format->depth_format) {
+ pass->has_depth_clear_attachment = true;
+ }
+ } else if (att->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
+ assert(att->format->has_stencil);
+ pass->has_stencil_clear_attachment = true;
+ }
}
for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {