zink: update scissor only when necessary
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10997>
This commit is contained in:
parent
dbc59aedb9
commit
962b162766
|
@ -892,6 +892,7 @@ zink_set_scissor_states(struct pipe_context *pctx,
|
||||||
|
|
||||||
for (unsigned i = 0; i < num_scissors; i++)
|
for (unsigned i = 0; i < num_scissors; i++)
|
||||||
ctx->vp_state.scissor_states[start_slot + i] = states[i];
|
ctx->vp_state.scissor_states[start_slot + i] = states[i];
|
||||||
|
ctx->scissor_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1710,6 +1711,7 @@ flush_batch(struct zink_context *ctx, bool sync)
|
||||||
ctx->pipeline_changed[0] = ctx->pipeline_changed[1] = true;
|
ctx->pipeline_changed[0] = ctx->pipeline_changed[1] = true;
|
||||||
ctx->vertex_buffers_dirty = true;
|
ctx->vertex_buffers_dirty = true;
|
||||||
ctx->vp_state_changed = true;
|
ctx->vp_state_changed = true;
|
||||||
|
ctx->scissor_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1787,7 +1789,12 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
|
||||||
ctx->rp_changed |= ctx->fb_state.nr_cbufs != state->nr_cbufs;
|
ctx->rp_changed |= ctx->fb_state.nr_cbufs != state->nr_cbufs;
|
||||||
ctx->rp_changed |= !!ctx->fb_state.zsbuf != !!state->zsbuf;
|
ctx->rp_changed |= !!ctx->fb_state.zsbuf != !!state->zsbuf;
|
||||||
|
|
||||||
|
unsigned w = ctx->fb_state.width;
|
||||||
|
unsigned h = ctx->fb_state.height;
|
||||||
|
|
||||||
util_copy_framebuffer_state(&ctx->fb_state, state);
|
util_copy_framebuffer_state(&ctx->fb_state, state);
|
||||||
|
if (ctx->fb_state.width != w || ctx->fb_state.height != h)
|
||||||
|
ctx->scissor_changed = true;
|
||||||
rebind_fb_state(ctx, NULL, true);
|
rebind_fb_state(ctx, NULL, true);
|
||||||
/* get_framebuffer adds a ref if the fb is reused or created;
|
/* get_framebuffer adds a ref if the fb is reused or created;
|
||||||
* always do get_framebuffer first to avoid deleting the same fb
|
* always do get_framebuffer first to avoid deleting the same fb
|
||||||
|
|
|
@ -204,6 +204,7 @@ struct zink_context {
|
||||||
|
|
||||||
struct zink_viewport_state vp_state;
|
struct zink_viewport_state vp_state;
|
||||||
bool vp_state_changed;
|
bool vp_state_changed;
|
||||||
|
bool scissor_changed;
|
||||||
|
|
||||||
float line_width;
|
float line_width;
|
||||||
float blend_constants[4];
|
float blend_constants[4];
|
||||||
|
|
|
@ -562,6 +562,7 @@ zink_draw_vbo(struct pipe_context *pctx,
|
||||||
else
|
else
|
||||||
vkCmdSetViewport(batch->state->cmdbuf, 0, ctx->vp_state.num_viewports, viewports);
|
vkCmdSetViewport(batch->state->cmdbuf, 0, ctx->vp_state.num_viewports, viewports);
|
||||||
}
|
}
|
||||||
|
if (ctx->scissor_changed || ctx->vp_state_changed || pipeline_changed) {
|
||||||
VkRect2D scissors[PIPE_MAX_VIEWPORTS];
|
VkRect2D scissors[PIPE_MAX_VIEWPORTS];
|
||||||
if (ctx->rast_state->base.scissor) {
|
if (ctx->rast_state->base.scissor) {
|
||||||
for (unsigned i = 0; i < ctx->vp_state.num_viewports; i++) {
|
for (unsigned i = 0; i < ctx->vp_state.num_viewports; i++) {
|
||||||
|
@ -582,8 +583,10 @@ zink_draw_vbo(struct pipe_context *pctx,
|
||||||
screen->vk_CmdSetScissorWithCountEXT(batch->state->cmdbuf, ctx->vp_state.num_viewports, scissors);
|
screen->vk_CmdSetScissorWithCountEXT(batch->state->cmdbuf, ctx->vp_state.num_viewports, scissors);
|
||||||
else
|
else
|
||||||
vkCmdSetScissor(batch->state->cmdbuf, 0, ctx->vp_state.num_viewports, scissors);
|
vkCmdSetScissor(batch->state->cmdbuf, 0, ctx->vp_state.num_viewports, scissors);
|
||||||
|
}
|
||||||
ctx->vp_state_changed = false;
|
ctx->vp_state_changed = false;
|
||||||
|
ctx->scissor_changed = false;
|
||||||
|
|
||||||
if (line_width_needed(reduced_prim, rast_state->hw_state.polygon_mode)) {
|
if (line_width_needed(reduced_prim, rast_state->hw_state.polygon_mode)) {
|
||||||
if (screen->info.feats.features.wideLines || ctx->line_width == 1.0f)
|
if (screen->info.feats.features.wideLines || ctx->line_width == 1.0f)
|
||||||
vkCmdSetLineWidth(batch->state->cmdbuf, ctx->line_width);
|
vkCmdSetLineWidth(batch->state->cmdbuf, ctx->line_width);
|
||||||
|
|
|
@ -474,6 +474,7 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
|
||||||
struct zink_screen *screen = zink_screen(pctx->screen);
|
struct zink_screen *screen = zink_screen(pctx->screen);
|
||||||
bool clip_halfz = ctx->rast_state ? ctx->rast_state->base.clip_halfz : false;
|
bool clip_halfz = ctx->rast_state ? ctx->rast_state->base.clip_halfz : false;
|
||||||
bool point_quad_rasterization = ctx->rast_state ? ctx->rast_state->base.point_quad_rasterization : false;
|
bool point_quad_rasterization = ctx->rast_state ? ctx->rast_state->base.point_quad_rasterization : false;
|
||||||
|
bool scissor = ctx->rast_state ? ctx->rast_state->base.scissor : false;
|
||||||
ctx->rast_state = cso;
|
ctx->rast_state = cso;
|
||||||
|
|
||||||
if (ctx->rast_state) {
|
if (ctx->rast_state) {
|
||||||
|
@ -503,6 +504,8 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
|
||||||
}
|
}
|
||||||
if (ctx->rast_state->base.point_quad_rasterization != point_quad_rasterization)
|
if (ctx->rast_state->base.point_quad_rasterization != point_quad_rasterization)
|
||||||
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_FRAGMENT);
|
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_FRAGMENT);
|
||||||
|
if (ctx->rast_state->base.scissor != scissor)
|
||||||
|
ctx->scissor_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue