aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-01-15 18:57:25 -0500
committerMarge Bot <[email protected]>2020-01-23 19:10:21 +0000
commit7ce84b256e0be7aea4c9a71ee630b6e85f951284 (patch)
tree7586b6dd23bec017f8012dc0f78b6ca8e8b4ad2b /src/gallium/drivers
parentbe772182e002fc4add5654fa84cfd940c0b1e773 (diff)
radeonsi: make si_compile_shader return bool
Reviewed-by: Timothy Arceri <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c24
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h8
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c7
3 files changed, 18 insertions, 21 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index d86b061c35f..a7d8a44e3a9 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -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:
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 3a1d0e44290..f5fe060b790 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -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,
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index d270ae7c31a..69827d0774b 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -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;