tu: Rename tu_render_pass_attachment::clear_views to used_views

It's not just used for clears, it was already used for loads and it
needs to be used for stores too so clear_views was a confusing name.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38064>
This commit is contained in:
Connor Abbott 2025-10-24 18:23:19 -04:00 committed by Marge Bot
parent 45a762727c
commit 6c3ed74ed2
3 changed files with 17 additions and 13 deletions

View file

@ -4710,7 +4710,7 @@ clear_sysmem_attachment(struct tu_cmd_buffer *cmd,
enum pipe_format format = vk_format_to_pipe_format(vk_format);
const struct tu_framebuffer *fb = cmd->state.framebuffer;
const struct tu_image_view *iview = cmd->state.attachments[a];
const uint32_t clear_views = cmd->state.pass->attachments[a].clear_views;
const uint32_t clear_views = cmd->state.pass->attachments[a].used_views;
const struct blit_ops *ops = &r2d_ops<CHIP>;
const VkClearValue *value = &cmd->state.clear_values[a];
if (cmd->state.pass->attachments[a].samples > 1)
@ -4807,7 +4807,7 @@ tu_clear_gmem_attachment(struct tu_cmd_buffer *cmd,
tu_emit_clear_gmem_attachment<CHIP>(cmd, cs, resolve_group, a, 0,
cmd->state.framebuffer->layers,
attachment->clear_views,
attachment->used_views,
attachment->clear_mask,
&cmd->state.clear_values[a], NULL);
}
@ -4828,7 +4828,7 @@ tu7_generic_clear_attachment(struct tu_cmd_buffer *cmd,
iview->view.ubwc_enabled, att->samples);
enum pipe_format format = vk_format_to_pipe_format(att->format);
for_each_layer(i, att->clear_views, cmd->state.framebuffer->layers) {
for_each_layer(i, att->used_views, cmd->state.framebuffer->layers) {
uint32_t layer = i + 0;
uint32_t mask =
aspect_write_mask_generic_clear(format, att->clear_mask);
@ -4909,7 +4909,7 @@ tu_emit_blit(struct tu_cmd_buffer *cmd,
uint32_t buffer_id = tu_resolve_group_include_buffer<CHIP>(resolve_group, format);
event_blit_setup(cs, buffer_id, attachment, blit_event_type, clear_mask);
for_each_layer(i, attachment->clear_views, cmd->state.framebuffer->layers) {
for_each_layer(i, attachment->used_views, cmd->state.framebuffer->layers) {
event_blit_dst_view blt_view = blt_view_from_tu_view(iview, i);
event_blit_run<CHIP>(cmd, cs, attachment, &blt_view, separate_stencil);
}
@ -5025,7 +5025,7 @@ load_3d_blit(struct tu_cmd_buffer *cmd,
/* Wait for CACHE_INVALIDATE to land */
tu_cs_emit_wfi(cs);
for_each_layer(i, att->clear_views, cmd->state.framebuffer->layers) {
for_each_layer(i, att->used_views, cmd->state.framebuffer->layers) {
if (cmd->state.pass->has_fdm) {
struct apply_load_coords_state state = {
.view = i,

View file

@ -626,10 +626,10 @@ tu_render_pass_opt_resolve_unresolve(struct tu_render_pass *pass)
*/
if (src_att->clear_mask) {
dst_att->clear_mask = src_att->clear_mask;
dst_att->clear_views = src_att->clear_views;
dst_att->used_views = src_att->used_views;
src_att->remapped_clear_att = dst_att_idx;
src_att->clear_mask = 0;
src_att->clear_views = 0;
src_att->used_views = 0;
}
/* Delete the unresolve. */
@ -971,7 +971,7 @@ tu_subpass_use_attachment(struct tu_render_pass *pass, int i, uint32_t a, const
att->gmem = true;
update_samples(subpass, att->samples);
att->clear_views |= subpass->multiview_mask;
att->used_views |= subpass->multiview_mask;
/* Loads and clears are emitted at the start of the subpass that needs them. */
att->first_subpass_idx = MIN2(i, att->first_subpass_idx);
@ -1471,7 +1471,7 @@ tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
subpass->samples = msrtss->rasterizationSamples;
} else {
att->gmem = true;
att->clear_views = info->viewMask;
att->used_views = info->viewMask;
attachment_set_ops(device, att, att_info->loadOp,
VK_ATTACHMENT_LOAD_OP_DONT_CARE, att_info->storeOp,
VK_ATTACHMENT_STORE_OP_DONT_CARE);
@ -1571,7 +1571,7 @@ tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
subpass->samples = msrtss->rasterizationSamples;
} else {
att->gmem = true;
att->clear_views = info->viewMask;
att->used_views = info->viewMask;
attachment_set_ops(
device, att, load_op, stencil_load_op, store_op,
stencil_store_op);
@ -1680,7 +1680,7 @@ tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
uint32_t att_idx = a++;
att->gmem = true;
att->clear_views = info->viewMask;
att->used_views = info->viewMask;
att->user_att = subpass->color_attachments[i].attachment;
VkAttachmentLoadOp load_op =
att_info->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR ? VK_ATTACHMENT_LOAD_OP_CLEAR :
@ -1720,7 +1720,7 @@ tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
VK_ATTACHMENT_STORE_OP_DONT_CARE,
VK_ATTACHMENT_STORE_OP_DONT_CARE);
att->gmem = true;
att->clear_views = info->viewMask;
att->used_views = info->viewMask;
att->user_att = subpass->depth_stencil_attachment.attachment;
subpass->depth_stencil_attachment.attachment = att_idx;
}

View file

@ -96,7 +96,11 @@ struct tu_render_pass_attachment
VkSampleCountFlagBits samples;
uint32_t cpp;
VkImageAspectFlags clear_mask;
uint32_t clear_views;
/* All views that are used with the attachment in all subpasses. Used to
* determine which views to apply loadOp/storeOp to.
*/
uint32_t used_views;
/* The internal MSRTSS attachment to clear when the user says to clear
* this attachment. Clear values must be remapped to this attachment.
*/