aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2018-11-28 11:32:01 +0100
committerMarek Olšák <[email protected]>2019-06-12 20:28:23 -0400
commit8b1343ca7926ce1f322424da8b7e099b5ee9ddea (patch)
tree01367b261bbc1febb85d2ddb31c5061d51c3cda4
parent77b05cc42df29472a7852b90575a19e8991815cd (diff)
radeonsi: let si_shader_create return a boolean
We didn't really use error codes anyway. Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_compute.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c18
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c8
4 files changed, 14 insertions, 16 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index a08ed7d65f5..006fb89a200 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -150,7 +150,7 @@ static void si_create_compute_state_async(void *job, int thread_index)
} else {
mtx_unlock(&sscreen->shader_cache_mutex);
- if (si_shader_create(sscreen, compiler, &program->shader, debug)) {
+ if (!si_shader_create(sscreen, compiler, &program->shader, debug)) {
program->shader.compilation_failed = true;
if (program->ir_type == PIPE_SHADER_IR_TGSI)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index d532d664307..17323fa69ec 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -7881,7 +7881,7 @@ static void si_fix_resource_usage(struct si_screen *sscreen,
}
}
-int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compiler,
+bool si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug)
{
@@ -7901,7 +7901,7 @@ int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compile
*/
r = si_compile_tgsi_shader(sscreen, compiler, shader, debug);
if (r)
- return r;
+ return false;
} else {
/* The shader consists of several parts:
*
@@ -7919,7 +7919,7 @@ int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compile
*/
if (!mainp)
- return -1;
+ return false;
/* Copy the compiled TGSI shader data over. */
shader->is_binary_shared = true;
@@ -7940,21 +7940,21 @@ int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compile
switch (sel->type) {
case PIPE_SHADER_VERTEX:
if (!si_shader_select_vs_parts(sscreen, compiler, shader, debug))
- return -1;
+ return false;
break;
case PIPE_SHADER_TESS_CTRL:
if (!si_shader_select_tcs_parts(sscreen, compiler, shader, debug))
- return -1;
+ return false;
break;
case PIPE_SHADER_TESS_EVAL:
break;
case PIPE_SHADER_GEOMETRY:
if (!si_shader_select_gs_parts(sscreen, compiler, shader, debug))
- return -1;
+ return false;
break;
case PIPE_SHADER_FRAGMENT:
if (!si_shader_select_ps_parts(sscreen, compiler, shader, debug))
- return -1;
+ return false;
/* Make sure we have at least as many VGPRs as there
* are allocated inputs.
@@ -8014,10 +8014,10 @@ int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compile
r = si_shader_binary_upload(sscreen, shader);
if (r) {
fprintf(stderr, "LLVM failed to upload shader\n");
- return r;
+ return false;
}
- return 0;
+ return true;
}
void si_shader_destroy(struct si_shader *shader)
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index b63045f662d..470a73359bd 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -683,7 +683,7 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug);
-int si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compiler,
+bool si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compiler,
struct si_shader *shader,
struct pipe_debug_callback *debug);
void si_shader_destroy(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 c4517fcf538..db939b73b0a 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1715,7 +1715,6 @@ static void si_build_shader_variant(struct si_shader *shader,
struct si_screen *sscreen = sel->screen;
struct ac_llvm_compiler *compiler;
struct pipe_debug_callback *debug = &shader->compiler_ctx_state.debug;
- int r;
if (thread_index >= 0) {
if (low_priority) {
@@ -1732,10 +1731,9 @@ static void si_build_shader_variant(struct si_shader *shader,
compiler = shader->compiler_ctx_state.compiler;
}
- r = si_shader_create(sscreen, compiler, shader, debug);
- if (unlikely(r)) {
- PRINT_ERR("Failed to build shader variant (type=%u) %d\n",
- sel->type, r);
+ if (unlikely(!si_shader_create(sscreen, compiler, shader, debug))) {
+ PRINT_ERR("Failed to build shader variant (type=%u)\n",
+ sel->type);
shader->compilation_failed = true;
return;
}