v3dv: store the clip window in the command buffer state
We will need this so we can match a render area for a new render pass
against the current clip rect and decide if we need to make adjustments.
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 d617593..9af49c2 100644
--- a/src/broadcom/vulkan/v3dv_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c
@@ -2059,8 +2059,6 @@
* since the hardware does guardband clipping, meaning
* primitives would rasterize outside of the view volume."
*/
-
- VkRect2D clip_window;
uint32_t minx, miny, maxx, maxy;
/* From the Vulkan spec:
@@ -2100,12 +2098,12 @@
if (miny > maxy)
maxy = miny;
- clip_window.offset.x = minx;
- clip_window.offset.y = miny;
- clip_window.extent.width = maxx - minx;
- clip_window.extent.height = maxy - miny;
+ cmd_buffer->state.clip_window.offset.x = minx;
+ cmd_buffer->state.clip_window.offset.y = miny;
+ cmd_buffer->state.clip_window.extent.width = maxx - minx;
+ cmd_buffer->state.clip_window.extent.height = maxy - miny;
- emit_clip_window(cmd_buffer->state.job, &clip_window);
+ emit_clip_window(cmd_buffer->state.job, &cmd_buffer->state.clip_window);
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_SCISSOR;
}
diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h
index 474de76..c734de7 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -690,6 +690,12 @@
struct v3dv_dynamic_state dynamic;
uint32_t dirty;
+ /* Current clip window. We use this to check whether we have an active
+ * scissor, since in that case we can't use TLB clears and need to fallback
+ * to drawing rects.
+ */
+ VkRect2D clip_window;
+
uint32_t attachment_count;
struct v3dv_cmd_buffer_attachment_state *attachments;