From 6430616e77100036ae201c86f4db83a73298e80a Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 29 Jan 2019 22:18:58 +0100 Subject: [PATCH] radv: track if subpasses have color attachments Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_pass.c | 3 +++ src/amd/vulkan/radv_pipeline.c | 10 +--------- src/amd/vulkan/radv_private.h | 3 +++ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/amd/vulkan/radv_pass.c b/src/amd/vulkan/radv_pass.c index b5b06b75b92..4d9fb0bf7df 100644 --- a/src/amd/vulkan/radv_pass.c +++ b/src/amd/vulkan/radv_pass.c @@ -81,12 +81,15 @@ radv_render_pass_compile(struct radv_render_pass *pass) pass_att->last_subpass_idx = i; } + subpass->has_color_att = false; for (uint32_t j = 0; j < subpass->color_count; j++) { struct radv_subpass_attachment *subpass_att = &subpass->color_attachments[j]; if (subpass_att->attachment == VK_ATTACHMENT_UNUSED) continue; + subpass->has_color_att = true; + struct radv_render_pass_attachment *pass_att = &pass->attachments[subpass_att->attachment]; diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index c96f86bff63..ab56a273a2c 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -1375,15 +1375,7 @@ radv_pipeline_init_dynamic_state(struct radv_pipeline *pipeline, * disabled or if the subpass of the render pass the pipeline is * created against does not use any color attachments. */ - bool uses_color_att = false; - for (unsigned i = 0; i < subpass->color_count; ++i) { - if (subpass->color_attachments[i].attachment != VK_ATTACHMENT_UNUSED) { - uses_color_att = true; - break; - } - } - - if (uses_color_att && states & RADV_DYNAMIC_BLEND_CONSTANTS) { + if (subpass->has_color_att && states & RADV_DYNAMIC_BLEND_CONSTANTS) { assert(pCreateInfo->pColorBlendState); typed_memcpy(dynamic->blend_constants, pCreateInfo->pColorBlendState->blendConstants, 4); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 3d1782b559d..d4a9e9f0e95 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1828,6 +1828,9 @@ struct radv_subpass { /** Subpass has at least one resolve attachment */ bool has_resolve; + /** Subpass has at least one color attachment */ + bool has_color_att; + struct radv_subpass_barrier start_barrier; uint32_t view_mask; -- 2.30.2