From 65398d571be888bfb6dc1b1db674279e33b30c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 2 Jan 2025 18:52:06 -0500 Subject: [PATCH] radeonsi: ignore pipe_rasterizer_state::force_persample_interp It just indicates that sample shading is enabled, which we were checking already. The state is redundant. Just check shader_info::fs::uses_sample_shading. ARB_sample_shading (GL3.3) doesn't set fs.uses_sample_shading in shader_info (which is for GL4.0), and that's why we have this codepath that forces per-sample interpolation. Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_state.c | 2 -- src/gallium/drivers/radeonsi/si_state.h | 1 - src/gallium/drivers/radeonsi/si_state_shaders.cpp | 5 ++++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index cefc8e02d39..4b9ad217ecc 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -979,7 +979,6 @@ static void *si_create_rs_state(struct pipe_context *ctx, const struct pipe_rast rs->clip_halfz = state->clip_halfz; rs->two_side = state->light_twoside; rs->multisample_enable = state->multisample; - rs->force_persample_interp = state->force_persample_interp; rs->clip_plane_enable = state->clip_plane_enable; rs->half_pixel_center = state->half_pixel_center; rs->line_stipple_enable = state->line_stipple_enable; @@ -1352,7 +1351,6 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state) si_ps_key_update_rasterizer(sctx); if (old_rs->flatshade != rs->flatshade || - old_rs->force_persample_interp != rs->force_persample_interp || old_rs->multisample_enable != rs->multisample_enable) si_ps_key_update_framebuffer_rasterizer_sample_shading(sctx); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index a83b6cc079b..2869aa717b4 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -84,7 +84,6 @@ struct si_state_rasterizer { unsigned flatshade_first : 1; unsigned two_side : 1; unsigned multisample_enable : 1; - unsigned force_persample_interp : 1; unsigned line_stipple_enable : 1; unsigned poly_stipple_enable : 1; unsigned line_smooth : 1; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index 1b7c6140744..c309d5e398c 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -2852,7 +2852,7 @@ void si_ps_key_update_framebuffer_rasterizer_sample_shading(struct si_context *s bool uses_persp_sample = sel->info.uses_persp_sample || (!rs->flatshade && sel->info.uses_persp_sample_color); - if (rs->force_persample_interp && rs->multisample_enable && + if (!sel->info.base.fs.uses_sample_shading && rs->multisample_enable && sctx->framebuffer.nr_samples > 1 && sctx->ps_iter_samples > 1) { key->ps.part.prolog.force_persp_sample_interp = uses_persp_center || uses_persp_centroid; @@ -2867,6 +2867,9 @@ void si_ps_key_update_framebuffer_rasterizer_sample_shading(struct si_context *s key->ps.part.prolog.force_samplemask_to_helper_invocation = 0; key->ps.mono.interpolate_at_sample_force_center = 0; } else if (rs->multisample_enable && sctx->framebuffer.nr_samples > 1) { + /* Note that sample shading is possible here. If it's enabled, all barycentrics are + * already set to "sample" except at_offset/at_sample. + */ key->ps.part.prolog.force_persp_sample_interp = 0; key->ps.part.prolog.force_linear_sample_interp = 0; key->ps.part.prolog.force_persp_center_interp = 0;