diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index e434665dd3b..45489055ec4 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -3272,8 +3272,7 @@ tu_pipeline_builder_emit_state(struct tu_pipeline_builder *builder, builder->graphics_state.rs); bool attachments_valid = builder->graphics_state.rp && - !(builder->graphics_state.rp->attachment_aspects & - VK_IMAGE_ASPECT_METADATA_BIT); + vk_render_pass_state_has_attachment_info(builder->graphics_state.rp); struct vk_color_blend_state dummy_cb = {}; const struct vk_color_blend_state *cb = builder->graphics_state.cb; if (attachments_valid && diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 7976c72e977..c65bab629e4 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -577,7 +577,7 @@ populate_mesh_prog_key(struct anv_pipeline_stage *stage, static uint32_t rp_color_mask(const struct vk_render_pass_state *rp) { - if (rp == NULL || rp->attachment_aspects == VK_IMAGE_ASPECT_METADATA_BIT) + if (rp == NULL || !vk_render_pass_state_has_attachment_info(rp)) return ((1u << MAX_RTS) - 1); uint32_t color_mask = 0; diff --git a/src/vulkan/runtime/vk_graphics_state.c b/src/vulkan/runtime/vk_graphics_state.c index 0efcb1a5bde..0b5ec547448 100644 --- a/src/vulkan/runtime/vk_graphics_state.c +++ b/src/vulkan/runtime/vk_graphics_state.c @@ -1111,12 +1111,6 @@ vk_dynamic_graphics_state_init_cal(struct vk_dynamic_graphics_state *dst, typed_memcpy(dst->cal.color_map, cal->color_map, MESA_VK_MAX_COLOR_ATTACHMENTS); } -static bool -vk_render_pass_state_is_complete(const struct vk_render_pass_state *rp) -{ - return rp->attachment_aspects != VK_IMAGE_ASPECT_METADATA_BIT; -} - static void vk_pipeline_flags_init(struct vk_graphics_pipeline_state *state, VkPipelineCreateFlags2KHR driver_rp_flags, @@ -1176,7 +1170,7 @@ vk_render_pass_state_init(struct vk_render_pass_state *rp, * it's complete and we don't need a new one. The one caveat here is that * we may need to add in some rendering flags. */ - if (old_rp != NULL && vk_render_pass_state_is_complete(old_rp)) { + if (old_rp != NULL && vk_render_pass_state_has_attachment_info(old_rp)) { *rp = *old_rp; return; } @@ -1477,8 +1471,8 @@ vk_graphics_pipeline_state_fill(const struct vk_device *device, * to NULL so it gets replaced with the new version. */ if (state->rp != NULL && - !vk_render_pass_state_is_complete(state->rp) && - vk_render_pass_state_is_complete(&rp)) + !vk_render_pass_state_has_attachment_info(state->rp) && + !vk_render_pass_state_has_attachment_info(&rp)) state->rp = NULL; } @@ -1569,7 +1563,7 @@ vk_graphics_pipeline_state_fill(const struct vk_device *device, */ if ((rp.attachment_aspects & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) || - !vk_render_pass_state_is_complete(&rp)) + !vk_render_pass_state_has_attachment_info(&rp)) needs |= MESA_VK_GRAPHICS_STATE_DEPTH_STENCIL_BIT; needs |= MESA_VK_GRAPHICS_STATE_INPUT_ATTACHMENT_MAP_BIT; @@ -1759,8 +1753,8 @@ vk_graphics_pipeline_state_merge(struct vk_graphics_pipeline_state *dst, * incomplete (view mask only). See vk_render_pass_state_init(). */ if (dst->rp != NULL && src->rp != NULL && - !vk_render_pass_state_is_complete(dst->rp) && - vk_render_pass_state_is_complete(src->rp)) + !vk_render_pass_state_has_attachment_info(dst->rp) && + vk_render_pass_state_has_attachment_info(src->rp)) dst->rp = src->rp; #define MERGE(STATE, type, state) \ diff --git a/src/vulkan/runtime/vk_graphics_state.h b/src/vulkan/runtime/vk_graphics_state.h index d18b4d5eb84..7d9339f119e 100644 --- a/src/vulkan/runtime/vk_graphics_state.h +++ b/src/vulkan/runtime/vk_graphics_state.h @@ -728,6 +728,12 @@ struct vk_render_pass_state { uint8_t depth_stencil_attachment_samples; }; +static inline bool +vk_render_pass_state_has_attachment_info(const struct vk_render_pass_state *rp) +{ + return rp->attachment_aspects != VK_IMAGE_ASPECT_METADATA_BIT; +} + static inline VkImageAspectFlags vk_pipeline_flags_feedback_loops(VkPipelineCreateFlags2KHR flags) {