From 536875fc5b40bb061edafbcc977bfdd094c950ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 25 Apr 2026 21:50:21 -0400 Subject: [PATCH] radeonsi: stop using TGSI definitions for interpolation define our own --- src/gallium/drivers/radeonsi/si_shader.c | 21 +++++++-------- src/gallium/drivers/radeonsi/si_shader.h | 6 +++++ src/gallium/drivers/radeonsi/si_shader_info.c | 27 +++++++++---------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 0af3dd79167..55c02360d69 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -13,7 +13,6 @@ #include "nir_xfb_info.h" #include "si_pipe.h" #include "si_shader_internal.h" -#include "pipe/p_shader_tokens.h" static void si_fix_resource_usage(struct si_screen *sscreen, struct si_shader *shader); @@ -1798,20 +1797,20 @@ static void si_get_ps_prolog_key(struct si_shader *shader, union si_shader_part_ case INTERP_MODE_COLOR: /* Force the interpolation location for colors here. */ if (shader->key.ps.part.prolog.force_persp_sample_interp) - location = TGSI_INTERPOLATE_LOC_SAMPLE; + location = SI_INTERPOLATE_LOC_SAMPLE; if (shader->key.ps.part.prolog.force_persp_center_interp) - location = TGSI_INTERPOLATE_LOC_CENTER; + location = SI_INTERPOLATE_LOC_CENTER; switch (location) { - case TGSI_INTERPOLATE_LOC_SAMPLE: + case SI_INTERPOLATE_LOC_SAMPLE: key->ps_prolog.color_interp[i] = AC_COLOR_INTERP_PERSP_SAMPLE; shader->config.spi_ps_input_ena |= S_0286CC_PERSP_SAMPLE_ENA(1); break; - case TGSI_INTERPOLATE_LOC_CENTER: + case SI_INTERPOLATE_LOC_CENTER: key->ps_prolog.color_interp[i] = AC_COLOR_INTERP_PERSP_CENTER; shader->config.spi_ps_input_ena |= S_0286CC_PERSP_CENTER_ENA(1); break; - case TGSI_INTERPOLATE_LOC_CENTROID: + case SI_INTERPOLATE_LOC_CENTROID: key->ps_prolog.color_interp[i] = AC_COLOR_INTERP_PERSP_CENTROID; shader->config.spi_ps_input_ena |= S_0286CC_PERSP_CENTROID_ENA(1); break; @@ -1822,24 +1821,24 @@ static void si_get_ps_prolog_key(struct si_shader *shader, union si_shader_part_ case INTERP_MODE_NOPERSPECTIVE: /* Force the interpolation location for colors here. */ if (shader->key.ps.part.prolog.force_linear_sample_interp) - location = TGSI_INTERPOLATE_LOC_SAMPLE; + location = SI_INTERPOLATE_LOC_SAMPLE; if (shader->key.ps.part.prolog.force_linear_center_interp) - location = TGSI_INTERPOLATE_LOC_CENTER; + location = SI_INTERPOLATE_LOC_CENTER; /* The VGPR assignment for non-monolithic shaders * works because InitialPSInputAddr is set on the * main shader and PERSP_PULL_MODEL is never used. */ switch (location) { - case TGSI_INTERPOLATE_LOC_SAMPLE: + case SI_INTERPOLATE_LOC_SAMPLE: key->ps_prolog.color_interp[i] = AC_COLOR_INTERP_LINEAR_SAMPLE; shader->config.spi_ps_input_ena |= S_0286CC_LINEAR_SAMPLE_ENA(1); break; - case TGSI_INTERPOLATE_LOC_CENTER: + case SI_INTERPOLATE_LOC_CENTER: key->ps_prolog.color_interp[i] = AC_COLOR_INTERP_LINEAR_CENTER; shader->config.spi_ps_input_ena |= S_0286CC_LINEAR_CENTER_ENA(1); break; - case TGSI_INTERPOLATE_LOC_CENTROID: + case SI_INTERPOLATE_LOC_CENTROID: key->ps_prolog.color_interp[i] = AC_COLOR_INTERP_LINEAR_CENTROID; shader->config.spi_ps_input_ena |= S_0286CC_LINEAR_CENTROID_ENA(1); break; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index 2517b79b4b0..a7202c2408a 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -234,6 +234,12 @@ enum SI_NUM_PARAMS = SI_PARAM_POS_FIXED_PT + 9, /* +8 for COLOR[0..1] */ }; +enum { + SI_INTERPOLATE_LOC_CENTER, + SI_INTERPOLATE_LOC_CENTROID, + SI_INTERPOLATE_LOC_SAMPLE, +}; + /* These fields are only set in current_vs_state (except INDEXED) in si_context, and they are * accessible in the shader via vs_state_bits in VS, TES, and GS. */ diff --git a/src/gallium/drivers/radeonsi/si_shader_info.c b/src/gallium/drivers/radeonsi/si_shader_info.c index bbb225f47c8..c042c9d46ee 100644 --- a/src/gallium/drivers/radeonsi/si_shader_info.c +++ b/src/gallium/drivers/radeonsi/si_shader_info.c @@ -7,7 +7,6 @@ #include "si_pipe.h" #include "si_shader_internal.h" #include "util/mesa-blake3.h" -#include "pipe/p_shader_tokens.h" #include "nir.h" #include "nir_tcs_info.h" #include "nir_xfb_info.h" @@ -67,7 +66,7 @@ get_color_input_interp_info(nir_intrinsic_instr *intr, enum glsl_interp_mode *in if (intr->intrinsic != nir_intrinsic_load_interpolated_input) { *interp_mode = INTERP_MODE_FLAT; - *interp_location = TGSI_INTERPOLATE_LOC_CENTER; + *interp_location = SI_INTERPOLATE_LOC_CENTER; return; } @@ -82,13 +81,13 @@ get_color_input_interp_info(nir_intrinsic_instr *intr, enum glsl_interp_mode *in switch (baryc->intrinsic) { case nir_intrinsic_load_barycentric_pixel: - *interp_location = TGSI_INTERPOLATE_LOC_CENTER; + *interp_location = SI_INTERPOLATE_LOC_CENTER; break; case nir_intrinsic_load_barycentric_centroid: - *interp_location = TGSI_INTERPOLATE_LOC_CENTROID; + *interp_location = SI_INTERPOLATE_LOC_CENTROID; break; case nir_intrinsic_load_barycentric_sample: - *interp_location = TGSI_INTERPOLATE_LOC_SAMPLE; + *interp_location = SI_INTERPOLATE_LOC_SAMPLE; break; default: UNREACHABLE("unexpected baryc intrinsic"); @@ -161,19 +160,19 @@ static void gather_io_instrinsic(const nir_shader *nir, struct si_shader_info *i switch (interp_mode) { case INTERP_MODE_SMOOTH: - if (interp_location == TGSI_INTERPOLATE_LOC_SAMPLE) + if (interp_location == SI_INTERPOLATE_LOC_SAMPLE) info->uses_sysval_persp_sample = true; - else if (interp_location == TGSI_INTERPOLATE_LOC_CENTROID) + else if (interp_location == SI_INTERPOLATE_LOC_CENTROID) info->uses_sysval_persp_centroid = true; - else if (interp_location == TGSI_INTERPOLATE_LOC_CENTER) + else if (interp_location == SI_INTERPOLATE_LOC_CENTER) info->uses_sysval_persp_center = true; break; case INTERP_MODE_NOPERSPECTIVE: - if (interp_location == TGSI_INTERPOLATE_LOC_SAMPLE) + if (interp_location == SI_INTERPOLATE_LOC_SAMPLE) info->uses_sysval_linear_sample = true; - else if (interp_location == TGSI_INTERPOLATE_LOC_CENTROID) + else if (interp_location == SI_INTERPOLATE_LOC_CENTROID) info->uses_sysval_linear_centroid = true; - else if (interp_location == TGSI_INTERPOLATE_LOC_CENTER) + else if (interp_location == SI_INTERPOLATE_LOC_CENTER) info->uses_sysval_linear_center = true; break; case INTERP_MODE_COLOR: @@ -181,11 +180,11 @@ static void gather_io_instrinsic(const nir_shader *nir, struct si_shader_info *i * in the rasterizer state, otherwise it will be SMOOTH. */ info->uses_interp_color = true; - if (interp_location == TGSI_INTERPOLATE_LOC_SAMPLE) + if (interp_location == SI_INTERPOLATE_LOC_SAMPLE) info->uses_persp_sample_color = true; - else if (interp_location == TGSI_INTERPOLATE_LOC_CENTROID) + else if (interp_location == SI_INTERPOLATE_LOC_CENTROID) info->uses_persp_centroid_color = true; - else if (interp_location == TGSI_INTERPOLATE_LOC_CENTER) + else if (interp_location == SI_INTERPOLATE_LOC_CENTER) info->uses_persp_center_color = true; break; case INTERP_MODE_FLAT: