From ffe36abf7c478a7477096b2464060c8ea50812cc Mon Sep 17 00:00:00 2001 From: antonino Date: Mon, 6 Mar 2023 12:18:22 +0100 Subject: [PATCH] zink: handle point_smooth emulation Reviewed-By: Mike Blumenkrantz Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/zink/zink_compiler.c | 7 +++++++ src/gallium/drivers/zink/zink_draw.cpp | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 0ce9d7b3..ae6aed5 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -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); diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index 793ded4..f27c721 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -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); -} \ No newline at end of file +} -- 2.7.4