iris: Refactor iris_debug_recompile interface to take a shader.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 17 Nov 2020 21:38:03 +0000 (13:38 -0800)
committerMarge Bot <eric+marge@anholt.net>
Fri, 22 Jan 2021 00:20:27 +0000 (00:20 +0000)
This simplifies each call site slightly and will save some interface
churn in the next rework.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8634>

src/gallium/drivers/iris/iris_program.c

index a6e48bc..95c24bb 100644 (file)
@@ -1022,15 +1022,21 @@ iris_setup_binding_table(const struct gen_device_info *devinfo,
 
 static void
 iris_debug_recompile(struct iris_context *ice,
-                     struct shader_info *info,
+                     struct iris_uncompiled_shader *ish,
                      const struct brw_base_prog_key *key)
 {
+   if (!ish)
+      return;
+
+   if (!ish->compiled_once) {
+      ish->compiled_once = true;
+      return;
+   }
+
    struct iris_screen *screen = (struct iris_screen *) ice->ctx.screen;
    const struct gen_device_info *devinfo = &screen->devinfo;
    const struct brw_compiler *c = screen->compiler;
-
-   if (!info)
-      return;
+   const struct shader_info *info = &ish->nir->info;
 
    c->shader_perf_log(&ice->dbg, "Recompiling %s shader for program %s: %s\n",
                       _mesa_shader_stage_to_string(info->stage),
@@ -1144,11 +1150,7 @@ iris_compile_vs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    uint32_t *so_decls =
       screen->vtbl.create_so_decl_list(&ish->stream_output,
@@ -1352,13 +1354,7 @@ iris_compile_tcs(struct iris_context *ice,
       return false;
    }
 
-   if (ish) {
-      if (ish->compiled_once) {
-         iris_debug_recompile(ice, &nir->info, &brw_key.base);
-      } else {
-         ish->compiled_once = true;
-      }
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_TCS, sizeof(*key), key, program,
@@ -1478,11 +1474,7 @@ iris_compile_tes(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    uint32_t *so_decls =
       screen->vtbl.create_so_decl_list(&ish->stream_output,
@@ -1600,11 +1592,7 @@ iris_compile_gs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    uint32_t *so_decls =
       screen->vtbl.create_so_decl_list(&ish->stream_output,
@@ -1719,11 +1707,7 @@ iris_compile_fs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_FS, sizeof(*key), key, program,
@@ -2003,11 +1987,7 @@ iris_compile_cs(struct iris_context *ice,
       return false;
    }
 
-   if (ish->compiled_once) {
-      iris_debug_recompile(ice, &nir->info, &brw_key.base);
-   } else {
-      ish->compiled_once = true;
-   }
+   iris_debug_recompile(ice, ish, &brw_key.base);
 
    struct iris_compiled_shader *shader =
       iris_upload_shader(ice, IRIS_CACHE_CS, sizeof(*key), key, program,