iris: Refactor iris_debug_recompile interface to take a shader.

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>
This commit is contained in:
Kenneth Graunke
2020-11-17 13:38:03 -08:00
committed by Marge Bot
parent 4423903089
commit 0f9f625089

View 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,