radeonsi: replace TGSI_INTERPOLATE with INTERP_MODE
[mesa.git] / src / gallium / drivers / radeonsi / si_shader.c
index 5a21a3cbb80ce215a5895c8dd77138e12063cb8a..d02227cd0f62b85d7c15d3abb971d3c48d341cdb 100644 (file)
@@ -909,7 +909,7 @@ bool si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader
 
 static void si_shader_dump_disassembly(struct si_screen *screen,
                                        const struct si_shader_binary *binary,
-                                       enum pipe_shader_type shader_type, unsigned wave_size,
+                                       gl_shader_stage stage, unsigned wave_size,
                                        struct pipe_debug_callback *debug, const char *name,
                                        FILE *file)
 {
@@ -917,7 +917,7 @@ static void si_shader_dump_disassembly(struct si_screen *screen,
 
    if (!ac_rtld_open(&rtld_binary, (struct ac_rtld_open_info){
                                       .info = &screen->info,
-                                      .shader_type = tgsi_processor_to_shader_stage(shader_type),
+                                      .shader_type = stage,
                                       .wave_size = wave_size,
                                       .num_parts = 1,
                                       .elf_ptrs = &binary->elf_buffer,
@@ -1029,7 +1029,7 @@ void si_shader_dump_stats_for_shader_db(struct si_screen *screen, struct si_shad
    const struct ac_shader_config *conf = &shader->config;
 
    if (screen->options.debug_disassembly)
-      si_shader_dump_disassembly(screen, &shader->binary, shader->selector->type,
+      si_shader_dump_disassembly(screen, &shader->binary, shader->selector->info.stage,
                                  si_get_shader_wave_size(shader), debug, "main", NULL);
 
    pipe_debug_message(debug, SHADER_INFO,
@@ -1113,7 +1113,6 @@ const char *si_get_shader_name(const struct si_shader *shader)
 void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
                     struct pipe_debug_callback *debug, FILE *file, bool check_debug_option)
 {
-   enum pipe_shader_type shader_type = shader->selector->type;
    gl_shader_stage stage = shader->selector->info.stage;
 
    if (!check_debug_option || si_can_dump_shader(sscreen, stage))
@@ -1136,20 +1135,20 @@ void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
       fprintf(file, "\n%s:\n", si_get_shader_name(shader));
 
       if (shader->prolog)
-         si_shader_dump_disassembly(sscreen, &shader->prolog->binary, shader_type, wave_size, debug,
+         si_shader_dump_disassembly(sscreen, &shader->prolog->binary, stage, wave_size, debug,
                                     "prolog", file);
       if (shader->previous_stage)
-         si_shader_dump_disassembly(sscreen, &shader->previous_stage->binary, shader_type,
+         si_shader_dump_disassembly(sscreen, &shader->previous_stage->binary, stage,
                                     wave_size, debug, "previous stage", file);
       if (shader->prolog2)
-         si_shader_dump_disassembly(sscreen, &shader->prolog2->binary, shader_type, wave_size,
+         si_shader_dump_disassembly(sscreen, &shader->prolog2->binary, stage, wave_size,
                                     debug, "prolog2", file);
 
-      si_shader_dump_disassembly(sscreen, &shader->binary, shader_type, wave_size, debug, "main",
+      si_shader_dump_disassembly(sscreen, &shader->binary, stage, wave_size, debug, "main",
                                  file);
 
       if (shader->epilog)
-         si_shader_dump_disassembly(sscreen, &shader->epilog->binary, shader_type, wave_size, debug,
+         si_shader_dump_disassembly(sscreen, &shader->epilog->binary, stage, wave_size, debug,
                                     "epilog", file);
       fprintf(file, "\n");
    }
@@ -1333,7 +1332,6 @@ static bool si_build_main_function(struct si_shader_context *ctx, struct si_shad
    const struct si_shader_info *info = &sel->info;
 
    ctx->shader = shader;
-   ctx->type = sel->type;
    ctx->stage = sel->info.stage;
 
    ctx->num_const_buffers = util_last_bit(info->const_buffers_declared);
@@ -1605,7 +1603,8 @@ static struct nir_shader *get_nir_shader(struct si_shader_selector *sel, bool *f
       return sel->nir;
    } else if (sel->nir_binary) {
       struct pipe_screen *screen = &sel->screen->b;
-      const void *options = screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR, sel->type);
+      const void *options = screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR,
+                                                         pipe_shader_type_from_mesa(sel->info.stage));
 
       struct blob_reader blob_reader;
       blob_reader_init(&blob_reader, sel->nir_binary, sel->nir_size);
@@ -1725,7 +1724,6 @@ static bool si_llvm_compile_shader(struct si_screen *sscreen, struct ac_llvm_com
 
          /* Reset the shader context. */
          ctx.shader = shader;
-         ctx.type = PIPE_SHADER_TESS_CTRL;
          ctx.stage = MESA_SHADER_TESS_CTRL;
 
          si_build_wrapper_function(&ctx, parts + !vs_needs_prolog, 4 - !vs_needs_prolog,
@@ -1790,7 +1788,6 @@ static bool si_llvm_compile_shader(struct si_screen *sscreen, struct ac_llvm_com
 
          /* Reset the shader context. */
          ctx.shader = shader;
-         ctx.type = PIPE_SHADER_GEOMETRY;
          ctx.stage = MESA_SHADER_GEOMETRY;
 
          /* Prepare the array of shader parts. */
@@ -1998,7 +1995,6 @@ si_get_shader_part(struct si_screen *sscreen, struct si_shader_part **list,
                                          shader.key.opt.ngg_culling & SI_NGG_CULL_GS_FAST_LAUNCH_ALL,
                                          shader.key.opt.vs_as_prim_discard_cs));
    ctx.shader = &shader;
-   ctx.type = tgsi_processor_to_shader_stage(stage);
    ctx.stage = stage;
 
    build(&ctx, key);
@@ -2157,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;
@@ -2195,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;