v3dv: save and restore push constant state during meta operations
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 22 Apr 2020 07:26:27 +0000 (09:26 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Oct 2020 21:21:29 +0000 (21:21 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

src/broadcom/vulkan/v3dv_cmd_buffer.c
src/broadcom/vulkan/v3dv_private.h

index b948039..ee90bae 100644 (file)
@@ -2841,6 +2841,13 @@ v3dv_cmd_buffer_meta_state_push(struct v3dv_cmd_buffer *cmd_buffer,
       memcpy(&state->meta.descriptor_state, &state->descriptor_state,
              sizeof(state->descriptor_state));
    }
+
+   /* FIXME: if we keep track of wether we have bound any push constant state
+    *        at all we could restruct this only to cases where it is actually
+    *        necessary.
+    */
+   memcpy(state->meta.push_constants, cmd_buffer->push_constants_data,
+          sizeof(state->meta.push_constants));
 }
 
 /* This restores command buffer state after a meta operation
@@ -2889,6 +2896,9 @@ v3dv_cmd_buffer_meta_state_pop(struct v3dv_cmd_buffer *cmd_buffer,
       state->descriptor_state.valid = 0;
    }
 
+   memcpy(cmd_buffer->push_constants_data, state->meta.push_constants,
+          sizeof(state->meta.push_constants));
+
    state->meta.pipeline = VK_NULL_HANDLE;
    state->meta.framebuffer = VK_NULL_HANDLE;
    state->meta.pass = VK_NULL_HANDLE;
index de36194..6fb2ade 100644 (file)
@@ -770,6 +770,8 @@ struct v3dv_cmd_buffer_state {
       struct v3dv_dynamic_state dynamic;
 
       struct v3dv_descriptor_state descriptor_state;
+
+      uint32_t push_constants[MAX_PUSH_CONSTANTS_SIZE / 4];
    } meta;
 
    /* Command buffer state for queries */