summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-01-29 22:18:58 +0100
committerSamuel Pitoiset <[email protected]>2019-02-04 13:19:14 +0100
commit6430616e77100036ae201c86f4db83a73298e80a (patch)
tree7aa8276cc62b24f399c7f0f7a22c602650ca4148 /src
parent1e810f1c53fa25f764e3f9aeaa34a931a527f8d1 (diff)
radv: track if subpasses have color attachments
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/radv_pass.c3
-rw-r--r--src/amd/vulkan/radv_pipeline.c10
-rw-r--r--src/amd/vulkan/radv_private.h3
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;