zink: handle point_smooth emulation

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21731>
This commit is contained in:
antonino 2023-03-06 12:18:22 +01:00 committed by Marge Bot
parent 3a59b2a670
commit ffe36abf7c
2 changed files with 11 additions and 3 deletions

View file

@ -3121,6 +3121,13 @@ zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs,
} else if (zink_fs_key(key)->lower_line_stipple)
NIR_PASS_V(nir, lower_line_stipple_fs);
if (zink_fs_key(key)->lower_point_smooth) {
NIR_PASS_V(nir, nir_lower_point_smooth);
NIR_PASS_V(nir, nir_lower_discard_if, nir_lower_discard_if_to_cf);
nir->info.fs.uses_discard = true;
need_optimize = true;
}
if (zink_fs_key(key)->robust_access)
NIR_PASS(need_optimize, nir, lower_txf_lod_robustness);

View file

@ -470,12 +470,13 @@ zink_draw(struct pipe_context *pctx,
bool rast_prim_changed = false;
bool lines_changed = false;
bool points_changed = false;
bool rast_state_changed = ctx->rast_state_changed;
if (mode_changed || ctx->gfx_pipeline_state.modules_changed ||
rast_state_changed) {
enum pipe_prim_type rast_prim = zink_rast_prim(ctx, dinfo);
if (rast_prim != ctx->gfx_pipeline_state.rast_prim) {
bool points_changed =
points_changed =
(ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_POINTS) !=
(rast_prim == PIPE_PRIM_POINTS);
@ -501,7 +502,7 @@ zink_draw(struct pipe_context *pctx,
ctx->gfx_pipeline_state.gfx_prim_mode = mode;
if (!screen->optimal_keys &&
(lines_changed || rast_state_changed || ctx->gfx_pipeline_state.modules_changed))
(lines_changed || points_changed || rast_state_changed || ctx->gfx_pipeline_state.modules_changed))
zink_set_primitive_emulation_keys(ctx);
if (index_size) {
@ -1256,4 +1257,4 @@ zink_init_screen_pipeline_libs(struct zink_screen *screen)
_mesa_set_init(&screen->pipeline_libs[7], screen, hash_gfx_program<7>, equals_gfx_program<7>);
for (unsigned i = 0; i < ARRAY_SIZE(screen->pipeline_libs_lock); i++)
simple_mtx_init(&screen->pipeline_libs_lock[i], mtx_plain);
}
}