radeonsi: replace TGSI_INTERPOLATE with INTERP_MODE
authorMarek Olšák <marek.olsak@amd.com>
Sat, 15 Aug 2020 06:46:35 +0000 (02:46 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 3 Sep 2020 03:03:00 +0000 (23:03 -0400)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6340>

src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader_nir.c
src/gallium/drivers/radeonsi/si_state_shaders.c

index 5d1d8ac8459d8910b36bcd430af6af0de0ae0cbc..d02227cd0f62b85d7c15d3abb971d3c48d341cdb 100644 (file)
@@ -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;
index 9abe7a863c89f840c9a30f991b0ab0c5cbd36baa..5b47753d3cc2da95e3162f4997ccefdf9d888ab9 100644 (file)
@@ -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;
index 93f8af114ba4df6d9c3bf1b7f0d1673bf3e26310..b7189e1435d2170208f5a66ad7c854796dfa1941 100644 (file)
@@ -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 ||