mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
radeonsi: make si_compile_shader return bool
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421>
This commit is contained in:
parent
be772182e0
commit
7ce84b256e
3 changed files with 18 additions and 21 deletions
|
|
@ -1714,10 +1714,10 @@ static struct nir_shader *get_nir_shader(struct si_shader_selector *sel,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int si_compile_shader(struct si_screen *sscreen,
|
||||
struct ac_llvm_compiler *compiler,
|
||||
struct si_shader *shader,
|
||||
struct pipe_debug_callback *debug)
|
||||
bool si_compile_shader(struct si_screen *sscreen,
|
||||
struct ac_llvm_compiler *compiler,
|
||||
struct si_shader *shader,
|
||||
struct pipe_debug_callback *debug)
|
||||
{
|
||||
struct si_shader_selector *sel = shader->selector;
|
||||
struct si_shader_context ctx;
|
||||
|
|
@ -1743,7 +1743,7 @@ int si_compile_shader(struct si_screen *sscreen,
|
|||
if (shader->key.opt.ngg_culling) {
|
||||
if (!si_build_main_function(&ctx, shader, nir, false, true)) {
|
||||
si_llvm_dispose(&ctx);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
ngg_cull_main_fn = ctx.main_fn;
|
||||
ctx.main_fn = NULL;
|
||||
|
|
@ -1751,7 +1751,7 @@ int si_compile_shader(struct si_screen *sscreen,
|
|||
|
||||
if (!si_build_main_function(&ctx, shader, nir, free_nir, false)) {
|
||||
si_llvm_dispose(&ctx);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (shader->is_monolithic && ctx.type == PIPE_SHADER_VERTEX) {
|
||||
|
|
@ -1834,7 +1834,7 @@ int si_compile_shader(struct si_screen *sscreen,
|
|||
|
||||
if (!si_build_main_function(&ctx, &shader_ls, nir, free_nir, false)) {
|
||||
si_llvm_dispose(&ctx);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
shader->info.uses_instanceid |= ls->info.uses_instanceid;
|
||||
parts[1] = ctx.main_fn;
|
||||
|
|
@ -1902,7 +1902,7 @@ int si_compile_shader(struct si_screen *sscreen,
|
|||
|
||||
if (!si_build_main_function(&ctx, &shader_es, nir, free_nir, false)) {
|
||||
si_llvm_dispose(&ctx);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
shader->info.uses_instanceid |= es->info.uses_instanceid;
|
||||
es_main = ctx.main_fn;
|
||||
|
|
@ -1977,7 +1977,7 @@ int si_compile_shader(struct si_screen *sscreen,
|
|||
si_should_optimize_less(compiler, shader->selector))) {
|
||||
si_llvm_dispose(&ctx);
|
||||
fprintf(stderr, "LLVM failed to compile shader\n");
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
si_llvm_dispose(&ctx);
|
||||
|
|
@ -2028,7 +2028,7 @@ int si_compile_shader(struct si_screen *sscreen,
|
|||
|
||||
si_calculate_max_simd_waves(shader);
|
||||
si_shader_dump_stats_for_shader_db(sscreen, shader, debug);
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2542,7 +2542,6 @@ bool si_create_shader_variant(struct si_screen *sscreen,
|
|||
{
|
||||
struct si_shader_selector *sel = shader->selector;
|
||||
struct si_shader *mainp = *si_get_main_shader_part(sel, &shader->key);
|
||||
int r;
|
||||
|
||||
/* LS, ES, VS are compiled on demand if the main part hasn't been
|
||||
* compiled for that stage.
|
||||
|
|
@ -2557,8 +2556,7 @@ bool si_create_shader_variant(struct si_screen *sscreen,
|
|||
/* Monolithic shader (compiled as a whole, has many variants,
|
||||
* may take a long time to compile).
|
||||
*/
|
||||
r = si_compile_shader(sscreen, compiler, shader, debug);
|
||||
if (r)
|
||||
if (!si_compile_shader(sscreen, compiler, shader, debug))
|
||||
return false;
|
||||
} else {
|
||||
/* The shader consists of several parts:
|
||||
|
|
|
|||
|
|
@ -832,10 +832,10 @@ struct si_shader_part {
|
|||
};
|
||||
|
||||
/* si_shader.c */
|
||||
int si_compile_shader(struct si_screen *sscreen,
|
||||
struct ac_llvm_compiler *compiler,
|
||||
struct si_shader *shader,
|
||||
struct pipe_debug_callback *debug);
|
||||
bool si_compile_shader(struct si_screen *sscreen,
|
||||
struct ac_llvm_compiler *compiler,
|
||||
struct si_shader *shader,
|
||||
struct pipe_debug_callback *debug);
|
||||
bool si_create_shader_variant(struct si_screen *sscreen,
|
||||
struct ac_llvm_compiler *compiler,
|
||||
struct si_shader *shader,
|
||||
|
|
|
|||
|
|
@ -2254,8 +2254,8 @@ static bool si_check_missing_main_part(struct si_screen *sscreen,
|
|||
main_part->key.as_ngg = key->as_ngg;
|
||||
main_part->is_monolithic = false;
|
||||
|
||||
if (si_compile_shader(sscreen, compiler_state->compiler,
|
||||
main_part, &compiler_state->debug) != 0) {
|
||||
if (!si_compile_shader(sscreen, compiler_state->compiler,
|
||||
main_part, &compiler_state->debug)) {
|
||||
FREE(main_part);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2632,8 +2632,7 @@ static void si_init_shader_selector_async(void *job, int thread_index)
|
|||
simple_mtx_unlock(&sscreen->shader_cache_mutex);
|
||||
|
||||
/* Compile the shader if it hasn't been loaded from the cache. */
|
||||
if (si_compile_shader(sscreen, compiler, shader,
|
||||
debug) != 0) {
|
||||
if (!si_compile_shader(sscreen, compiler, shader, debug)) {
|
||||
FREE(shader);
|
||||
fprintf(stderr, "radeonsi: can't compile a main shader part\n");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue