mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
zink: improve precision on changes to depth bias between draws
this cuts calls here from 18k/frame to 18/frame in some synthetic benchmarks Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33849>
This commit is contained in:
parent
ac638928a8
commit
28259584f4
4 changed files with 17 additions and 9 deletions
|
|
@ -3903,7 +3903,7 @@ zink_set_framebuffer_state(struct pipe_context *pctx,
|
|||
}
|
||||
if (depth_bias_scale_factor != ctx->depth_bias_scale_factor &&
|
||||
ctx->rast_state && ctx->rast_state->base.offset_units_unscaled)
|
||||
ctx->rast_state_changed = true;
|
||||
ctx->depth_bias_changed = true;
|
||||
rebind_fb_state(ctx, NULL, true);
|
||||
ctx->fb_state.samples = MAX2(samples, 1);
|
||||
zink_update_framebuffer_state(ctx);
|
||||
|
|
|
|||
|
|
@ -692,14 +692,9 @@ zink_draw(struct pipe_context *pctx,
|
|||
ctx->line_width_changed = false;
|
||||
}
|
||||
|
||||
if (BATCH_CHANGED || mode_changed ||
|
||||
ctx->gfx_pipeline_state.modules_changed ||
|
||||
rast_state_changed) {
|
||||
bool depth_bias =
|
||||
zink_prim_type(ctx, dinfo) == MESA_PRIM_TRIANGLES &&
|
||||
rast_state->offset_fill;
|
||||
|
||||
if (depth_bias) {
|
||||
bool using_depth_bias = zink_prim_type(ctx, dinfo) == MESA_PRIM_TRIANGLES && rast_state->offset_fill;
|
||||
if (BATCH_CHANGED || using_depth_bias != ctx->was_using_depth_bias || ctx->depth_bias_changed) {
|
||||
if (using_depth_bias) {
|
||||
if (rast_state->base.offset_units_unscaled) {
|
||||
VKCTX(CmdSetDepthBias)(bs->cmdbuf, rast_state->offset_units * ctx->depth_bias_scale_factor, rast_state->offset_clamp, rast_state->offset_scale);
|
||||
} else {
|
||||
|
|
@ -709,7 +704,9 @@ zink_draw(struct pipe_context *pctx,
|
|||
VKCTX(CmdSetDepthBias)(bs->cmdbuf, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
ctx->was_using_depth_bias = using_depth_bias;
|
||||
ctx->rast_state_changed = false;
|
||||
ctx->depth_bias_changed = false;
|
||||
|
||||
if (DYNAMIC_STATE != ZINK_NO_DYNAMIC_STATE) {
|
||||
if (ctx->sample_locations_changed) {
|
||||
|
|
|
|||
|
|
@ -769,6 +769,15 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
|
|||
if (ctx->rast_state->base.half_pixel_center != half_pixel_center)
|
||||
ctx->vp_state_changed = true;
|
||||
|
||||
#define FLT_DIFF(a) (fabs(prev_state->a - ctx->rast_state->a) > FLT_EPSILON)
|
||||
if (prev_state)
|
||||
ctx->depth_bias_changed = prev_state->offset_fill != ctx->rast_state->offset_fill ||
|
||||
FLT_DIFF(offset_units) ||
|
||||
FLT_DIFF(offset_clamp) ||
|
||||
FLT_DIFF(offset_scale);
|
||||
else
|
||||
ctx->depth_bias_changed = true;
|
||||
|
||||
if (!screen->optimal_keys)
|
||||
zink_update_gs_key_rectangular_line(ctx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1923,6 +1923,7 @@ struct zink_context {
|
|||
bool disable_fs;
|
||||
bool disable_color_writes;
|
||||
bool was_line_loop;
|
||||
bool was_using_depth_bias;
|
||||
bool fs_query_active;
|
||||
bool occlusion_query_active;
|
||||
bool primitives_generated_active;
|
||||
|
|
@ -2036,6 +2037,7 @@ struct zink_context {
|
|||
bool blend_color_changed : 1;
|
||||
bool sample_mask_changed : 1;
|
||||
bool rast_state_changed : 1;
|
||||
bool depth_bias_changed : 1;
|
||||
bool line_width_changed : 1;
|
||||
bool dsa_state_changed : 1;
|
||||
bool stencil_ref_changed : 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue