radeonsi: assume that selector != NULL for compute shaders
authorMarek Olšák <marek.olsak@amd.com>
Tue, 16 Jul 2019 02:00:05 +0000 (22:00 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 20 Jul 2019 00:16:48 +0000 (20:16 -0400)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/radeonsi/si_shader.c

index 8d06859f1f2d262103ec7966e0fb6a51f4ad6f8d..8017210ccd222142808e43e2a3e3b1c5a040ebb9 100644 (file)
@@ -5212,7 +5212,6 @@ static bool si_shader_binary_open(struct si_screen *screen,
                                  struct ac_rtld_binary *rtld)
 {
        const struct si_shader_selector *sel = shader->selector;
-       enum pipe_shader_type shader_type = sel ? sel->type : PIPE_SHADER_COMPUTE;
        const char *part_elfs[5];
        size_t part_sizes[5];
        unsigned num_parts = 0;
@@ -5258,7 +5257,7 @@ static bool si_shader_binary_open(struct si_screen *screen,
                        .options = {
                                .halt_at_entry = screen->options.halt_shaders,
                        },
-                       .shader_type = tgsi_processor_to_shader_stage(shader_type),
+                       .shader_type = tgsi_processor_to_shader_stage(sel->type),
                        .num_parts = num_parts,
                        .elf_ptrs = part_elfs,
                        .elf_sizes = part_sizes,
@@ -5488,12 +5487,10 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
                                 bool check_debug_option)
 {
        const struct ac_shader_config *conf = &shader->config;
-       enum pipe_shader_type shader_type =
-               shader->selector ? shader->selector->type : PIPE_SHADER_COMPUTE;
 
        if (!check_debug_option ||
-           si_can_dump_shader(sscreen, shader_type)) {
-               if (shader_type == PIPE_SHADER_FRAGMENT) {
+           si_can_dump_shader(sscreen, shader->selector->type)) {
+               if (shader->selector->type == PIPE_SHADER_FRAGMENT) {
                        fprintf(file, "*** SHADER CONFIG ***\n"
                                "SPI_PS_INPUT_ADDR = 0x%04x\n"
                                "SPI_PS_INPUT_ENA  = 0x%04x\n",
@@ -5522,10 +5519,7 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
 
 const char *si_get_shader_name(const struct si_shader *shader)
 {
-       enum pipe_shader_type shader_type =
-               shader->selector ? shader->selector->type : PIPE_SHADER_COMPUTE;
-
-       switch (shader_type) {
+       switch (shader->selector->type) {
        case PIPE_SHADER_VERTEX:
                if (shader->key.as_es)
                        return "Vertex Shader as ES";
@@ -5564,8 +5558,7 @@ 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 ? shader->selector->type : PIPE_SHADER_COMPUTE;
+       enum pipe_shader_type shader_type = shader->selector->type;
 
        if (!check_debug_option ||
            si_can_dump_shader(sscreen, shader_type))
@@ -5863,8 +5856,7 @@ static void si_dump_shader_key_vs(const struct si_shader_key *key,
 static void si_dump_shader_key(const struct si_shader *shader, FILE *f)
 {
        const struct si_shader_key *key = &shader->key;
-       enum pipe_shader_type shader_type =
-               shader->selector ? shader->selector->type : PIPE_SHADER_COMPUTE;
+       enum pipe_shader_type shader_type = shader->selector->type;
 
        fprintf(f, "SHADER KEY\n");