v3dv: don't reset descriptor state after a meta operation

If the meta operation did not change descriptor state then we should keep it,
not reset it.

Fixes:
dEQP-VK.fragment_operations.early_fragment.early_fragment_tests_stencil
dEQP-VK.fragment_operations.early_fragment.no_early_fragment_tests_stencil

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c
index 2ab2b4f..6471a71 100644
--- a/src/broadcom/vulkan/v3dv_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c
@@ -3572,9 +3572,14 @@
     */
    struct v3dv_descriptor_state *gfx_descriptor_state =
       &state->descriptor_state[VK_PIPELINE_BIND_POINT_GRAPHICS];
-   if (push_descriptor_state && gfx_descriptor_state->valid != 0) {
-      memcpy(&state->meta.descriptor_state, gfx_descriptor_state,
-             sizeof(state->descriptor_state));
+   if (push_descriptor_state) {
+      if (gfx_descriptor_state->valid != 0) {
+         memcpy(&state->meta.descriptor_state, gfx_descriptor_state,
+                sizeof(state->descriptor_state));
+      }
+      state->meta.has_descriptor_state = true;
+   } else {
+      state->meta.has_descriptor_state = false;
    }
 
    /* FIXME: if we keep track of wether we have bound any push constant state
@@ -3629,12 +3634,14 @@
       state->pipeline = VK_NULL_HANDLE;
    }
 
-   if (state->meta.descriptor_state.valid != 0) {
-      memcpy(&state->descriptor_state[VK_PIPELINE_BIND_POINT_GRAPHICS],
-             &state->meta.descriptor_state,
-             sizeof(state->descriptor_state));
-   } else {
-      state->descriptor_state[VK_PIPELINE_BIND_POINT_GRAPHICS].valid = 0;
+   if (state->meta.has_descriptor_state) {
+      if (state->meta.descriptor_state.valid != 0) {
+         memcpy(&state->descriptor_state[VK_PIPELINE_BIND_POINT_GRAPHICS],
+                &state->meta.descriptor_state,
+                sizeof(state->descriptor_state));
+      } else {
+         state->descriptor_state[VK_PIPELINE_BIND_POINT_GRAPHICS].valid = 0;
+      }
    }
 
    memcpy(cmd_buffer->push_constants_data, state->meta.push_constants,
@@ -3644,7 +3651,7 @@
    state->meta.framebuffer = VK_NULL_HANDLE;
    state->meta.pass = VK_NULL_HANDLE;
    state->meta.subpass_idx = -1;
-   state->meta.descriptor_state.valid = 0;
+   state->meta.has_descriptor_state = false;
 }
 
 /* FIXME: C&P from v3dx_draw. Refactor to common place? */
diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h
index 276fc1a..d1abb32 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -914,6 +914,7 @@
       struct v3dv_dynamic_state dynamic;
 
       struct v3dv_descriptor_state descriptor_state;
+      bool has_descriptor_state;
 
       uint32_t push_constants[MAX_PUSH_CONSTANTS_SIZE / 4];
    } meta;