From a803008c7f1e4b0bdf0a377cdcf4fe853fd20e1f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 15 Aug 2020 02:46:35 -0400 Subject: [PATCH] radeonsi: replace TGSI_INTERPOLATE with INTERP_MODE Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_shader.c | 12 ++++++------ src/gallium/drivers/radeonsi/si_shader_nir.c | 13 +++++++++---- src/gallium/drivers/radeonsi/si_state_shaders.c | 6 +++--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 5d1d8ac8459..d02227cd0f6 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2153,15 +2153,15 @@ void si_get_ps_prolog_key(struct si_shader *shader, union si_shader_part_key *ke key->ps_prolog.color_attr_index[i] = color[i]; - if (shader->key.part.ps.prolog.flatshade_colors && interp == TGSI_INTERPOLATE_COLOR) - interp = TGSI_INTERPOLATE_CONSTANT; + if (shader->key.part.ps.prolog.flatshade_colors && interp == INTERP_MODE_COLOR) + interp = INTERP_MODE_FLAT; switch (interp) { - case TGSI_INTERPOLATE_CONSTANT: + case INTERP_MODE_FLAT: key->ps_prolog.color_interp_vgpr_index[i] = -1; break; - case TGSI_INTERPOLATE_PERSPECTIVE: - case TGSI_INTERPOLATE_COLOR: + case INTERP_MODE_SMOOTH: + case INTERP_MODE_COLOR: /* Force the interpolation location for colors here. */ if (shader->key.part.ps.prolog.force_persp_sample_interp) location = TGSI_INTERPOLATE_LOC_SAMPLE; @@ -2191,7 +2191,7 @@ void si_get_ps_prolog_key(struct si_shader *shader, union si_shader_part_key *ke assert(0); } break; - case TGSI_INTERPOLATE_LINEAR: + case INTERP_MODE_NOPERSPECTIVE: /* Force the interpolation location for colors here. */ if (shader->key.part.ps.prolog.force_linear_sample_interp) location = TGSI_INTERPOLATE_LOC_SAMPLE; diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 9abe7a863c8..5b47753d3cc 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -48,14 +48,14 @@ static const nir_deref_instr *tex_get_texture_deref(nir_tex_instr *instr) static void scan_io_usage(struct si_shader_info *info, nir_intrinsic_instr *intr, bool is_input) { - unsigned interp = TGSI_INTERPOLATE_CONSTANT; /* load_input uses flat shading */ + unsigned interp = INTERP_MODE_FLAT; /* load_input uses flat shading */ if (intr->intrinsic == nir_intrinsic_load_interpolated_input) { nir_intrinsic_instr *baryc = nir_instr_as_intrinsic(intr->src[0].ssa->parent_instr); if (baryc) { if (nir_intrinsic_infos[baryc->intrinsic].index_map[NIR_INTRINSIC_INTERP_MODE] > 0) - interp = tgsi_get_interp_mode(nir_intrinsic_interp_mode(baryc), false); + interp = nir_intrinsic_interp_mode(baryc); else unreachable("unknown barycentric intrinsic"); } else { @@ -513,8 +513,13 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf } } - info->color_interpolate[0] = tgsi_get_interp_mode(nir->info.fs.color0_interp, true); - info->color_interpolate[1] = tgsi_get_interp_mode(nir->info.fs.color1_interp, true); + info->color_interpolate[0] = nir->info.fs.color0_interp; + info->color_interpolate[1] = nir->info.fs.color1_interp; + for (unsigned i = 0; i < 2; i++) { + if (info->color_interpolate[i] == INTERP_MODE_NONE) + info->color_interpolate[i] = INTERP_MODE_COLOR; + } + info->color_interpolate_loc[0] = nir->info.fs.color0_sample ? TGSI_INTERPOLATE_LOC_SAMPLE : nir->info.fs.color0_centroid ? TGSI_INTERPOLATE_LOC_CENTROID : TGSI_INTERPOLATE_LOC_CENTER; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 93f8af114ba..b7189e1435d 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -3197,13 +3197,13 @@ static void si_delete_shader_selector(struct pipe_context *ctx, void *state) } static unsigned si_get_ps_input_cntl(struct si_context *sctx, struct si_shader *vs, unsigned name, - unsigned index, unsigned interpolate) + unsigned index, enum glsl_interp_mode interpolate) { struct si_shader_info *vsinfo = &vs->selector->info; unsigned j, offset, ps_input_cntl = 0; - if (interpolate == TGSI_INTERPOLATE_CONSTANT || - (interpolate == TGSI_INTERPOLATE_COLOR && sctx->flatshade) || name == TGSI_SEMANTIC_PRIMID) + if (interpolate == INTERP_MODE_FLAT || + (interpolate == INTERP_MODE_COLOR && sctx->flatshade) || name == TGSI_SEMANTIC_PRIMID) ps_input_cntl |= S_028644_FLAT_SHADE(1); if (name == TGSI_SEMANTIC_PCOORD || -- 2.30.2