v3dv: drop incorrect assertion on number of clear values at render pass begin
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 19 Mar 2020 09:11:28 +0000 (10:11 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Oct 2020 21:21:28 +0000 (21:21 +0000)
There can be more clear values than attachments, we should just ignore them
in that case.

Fixes some tests in:
dEQP-VK.fragment_operations.*

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

src/broadcom/vulkan/v3dv_cmd_buffer.c

index 3a9d29e..ac75c2b 100644 (file)
@@ -795,8 +795,13 @@ cmd_buffer_state_set_clear_values(struct v3dv_cmd_buffer *cmd_buffer,
 {
    struct v3dv_cmd_buffer_state *state = &cmd_buffer->state;
    const struct v3dv_render_pass *pass = state->pass;
-   assert(count <= pass->attachment_count);
 
+   /* There could be less clear values than attachments in the render pass, in
+    * which case we only want to process as many as we have, or there could be
+    * more, in which case we want to ignore those for which we don't have a
+    * corresponding attachment.
+    */
+   count = MIN2(count, pass->attachment_count);
    for (uint32_t i = 0; i < count; i++) {
       const struct v3dv_render_pass_attachment *attachment =
          &pass->attachments[i];