From e5642a36a015fa3950fcc13a01e37dd6060c9274 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 1 Apr 2020 10:17:22 +0200 Subject: [PATCH] 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: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 12 +++++------- src/broadcom/vulkan/v3dv_private.h | 6 ++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index d6175936b59..9af49c29f86 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -2059,8 +2059,6 @@ emit_scissor(struct v3dv_cmd_buffer *cmd_buffer) * 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 @@ emit_scissor(struct v3dv_cmd_buffer *cmd_buffer) 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 474de762990..c734de74f86 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -690,6 +690,12 @@ struct v3dv_cmd_buffer_state { 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;