Mesa (master): lavapipe: don't write to pending clear aspects in cmd buffer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 3 21:46:13 UTC 2020


Module: Mesa
Branch: master
Commit: 33a2f27ce96203bce6c10f59ac7c863379efa30d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33a2f27ce96203bce6c10f59ac7c863379efa30d

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Oct 30 13:31:26 2020 +1000

lavapipe: don't write to pending clear aspects in cmd buffer

When the cmd buffer is recorded, we record the attachments state
into it, however we use the pending clear aspects to keep track
of clears, but it should be kept in the state no overwrritten
in the cmd buffer.

Allocate some memory to store this hanging off the state.

This fixes gears and radialblur demos.

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7416>

---

 src/gallium/frontends/lavapipe/lvp_execute.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index 419e6319874..681fce6383d 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -120,6 +120,8 @@ struct rendering_state {
    unsigned min_samples;
 
    struct lvp_attachment_state *attachments;
+   VkImageAspectFlags *pending_clear_aspects;
+   int num_pending_aspects;
 };
 
 static void emit_compute_state(struct rendering_state *state)
@@ -1082,7 +1084,7 @@ attachment_needs_clear(struct rendering_state *state,
                        uint32_t a)
 {
    return (a != VK_ATTACHMENT_UNUSED &&
-           state->attachments[a].pending_clear_aspects);
+           state->pending_clear_aspects[a]);
 }
 
 static bool
@@ -1134,7 +1136,7 @@ static void render_subpass_clear(struct rendering_state *state)
                                        state->render_area.extent.width, state->render_area.extent.height,
                                        false);
 
-      state->attachments[a].pending_clear_aspects = 0;
+      state->pending_clear_aspects[a] = 0;
    }
 
    if (subpass->depth_stencil_attachment) {
@@ -1171,7 +1173,7 @@ static void render_subpass_clear(struct rendering_state *state)
                                              state->render_area.offset.x, state->render_area.offset.y,
                                              state->render_area.extent.width, state->render_area.extent.height,
                                              false);
-         state->attachments[ds].pending_clear_aspects = 0;
+         state->pending_clear_aspects[ds] = 0;
       }
    }
 
@@ -1262,6 +1264,14 @@ static void handle_begin_render_pass(struct lvp_cmd_buffer_entry *cmd,
    state->framebuffer.height = state->vk_framebuffer->height;
    state->framebuffer.layers = state->vk_framebuffer->layers;
 
+   if (state->num_pending_aspects < state->pass->attachment_count) {
+      state->pending_clear_aspects = realloc(state->pending_clear_aspects, sizeof(VkImageAspectFlags) * state->pass->attachment_count);
+      state->num_pending_aspects = state->pass->attachment_count;
+   }
+
+   for (unsigned a = 0; a < state->pass->attachment_count; a++) {
+      state->pending_clear_aspects[a] = state->attachments[a].pending_clear_aspects;
+   }
    begin_render_subpass(state, 0);
 }
 
@@ -2473,5 +2483,6 @@ VkResult lvp_execute_cmds(struct lvp_device *device,
       state.pctx->set_shader_images(state.pctx, s, 0, device->physical_device->max_images, NULL);
    }
 
+   free(state.pending_clear_aspects);
    return VK_SUCCESS;
 }



More information about the mesa-commit mailing list