radv: track if subpasses have color attachments

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset
2019-01-29 22:18:58 +01:00
parent 1e810f1c53
commit 6430616e77
3 changed files with 7 additions and 9 deletions
+3
View File
@@ -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];
+1 -9
View File
@@ -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);
+3
View File
@@ -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;