mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 06:20:19 +01:00
radeonsi: return bool from si_shader_binary_upload
We didn't really use error codes anyway. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
8b1343ca79
commit
bf11c594dd
4 changed files with 16 additions and 19 deletions
|
|
@ -145,7 +145,7 @@ static void si_create_compute_state_async(void *job, int thread_index)
|
|||
si_shader_dump(sscreen, shader, debug, PIPE_SHADER_COMPUTE,
|
||||
stderr, true);
|
||||
|
||||
if (si_shader_binary_upload(sscreen, shader))
|
||||
if (!si_shader_binary_upload(sscreen, shader))
|
||||
program->shader.compilation_failed = true;
|
||||
} else {
|
||||
mtx_unlock(&sscreen->shader_cache_mutex);
|
||||
|
|
@ -254,7 +254,7 @@ static void *si_create_compute_state(
|
|||
}
|
||||
si_shader_dump(sctx->screen, &program->shader, &sctx->debug,
|
||||
PIPE_SHADER_COMPUTE, stderr, true);
|
||||
if (si_shader_binary_upload(sctx->screen, &program->shader) < 0) {
|
||||
if (!si_shader_binary_upload(sctx->screen, &program->shader)) {
|
||||
fprintf(stderr, "LLVM failed to upload shader\n");
|
||||
FREE(program);
|
||||
return NULL;
|
||||
|
|
@ -392,7 +392,7 @@ static bool si_setup_compute_scratch_buffer(struct si_context *sctx,
|
|||
|
||||
si_shader_apply_scratch_relocs(shader, scratch_va);
|
||||
|
||||
if (si_shader_binary_upload(sctx->screen, shader))
|
||||
if (!si_shader_binary_upload(sctx->screen, shader))
|
||||
return false;
|
||||
|
||||
si_resource_reference(&shader->scratch_bo,
|
||||
|
|
|
|||
|
|
@ -5088,7 +5088,7 @@ static unsigned si_get_shader_binary_size(const struct si_shader *shader)
|
|||
return size + DEBUGGER_NUM_MARKERS * 4;
|
||||
}
|
||||
|
||||
int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
|
||||
bool si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
|
||||
{
|
||||
const struct ac_shader_binary *prolog =
|
||||
shader->prolog ? &shader->prolog->binary : NULL;
|
||||
|
|
@ -5118,7 +5118,7 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
|
|||
align(bo_size, SI_CPDMA_ALIGNMENT),
|
||||
256);
|
||||
if (!shader->bo)
|
||||
return -ENOMEM;
|
||||
return false;
|
||||
|
||||
/* Upload. */
|
||||
ptr = sscreen->ws->buffer_map(shader->bo->buf, NULL,
|
||||
|
|
@ -5158,7 +5158,7 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
|
|||
ptr32[i] = DEBUGGER_END_OF_CODE_MARKER;
|
||||
|
||||
sscreen->ws->buffer_unmap(shader->bo->buf);
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void si_shader_dump_disassembly(const struct ac_shader_binary *binary,
|
||||
|
|
@ -5490,7 +5490,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
|
|||
LLVMBuilderRef builder;
|
||||
struct si_shader_output_values outputs[SI_MAX_VS_OUTPUTS];
|
||||
struct tgsi_shader_info *gsinfo = &gs_selector->info;
|
||||
int i, r;
|
||||
int i;
|
||||
|
||||
|
||||
shader = CALLOC_STRUCT(si_shader);
|
||||
|
|
@ -5599,22 +5599,22 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
|
|||
ctx.type = PIPE_SHADER_GEOMETRY; /* override for shader dumping */
|
||||
si_llvm_optimize_module(&ctx);
|
||||
|
||||
r = si_compile_llvm(sscreen, &ctx.shader->binary,
|
||||
bool ok = false;
|
||||
if (si_compile_llvm(sscreen, &ctx.shader->binary,
|
||||
&ctx.shader->config, ctx.compiler,
|
||||
ctx.ac.module,
|
||||
debug, PIPE_SHADER_GEOMETRY,
|
||||
"GS Copy Shader", false);
|
||||
if (!r) {
|
||||
"GS Copy Shader", false) == 0) {
|
||||
if (si_can_dump_shader(sscreen, PIPE_SHADER_GEOMETRY))
|
||||
fprintf(stderr, "GS Copy Shader:\n");
|
||||
si_shader_dump(sscreen, ctx.shader, debug,
|
||||
PIPE_SHADER_GEOMETRY, stderr, true);
|
||||
r = si_shader_binary_upload(sscreen, ctx.shader);
|
||||
ok = si_shader_binary_upload(sscreen, ctx.shader);
|
||||
}
|
||||
|
||||
si_llvm_dispose(&ctx);
|
||||
|
||||
if (r != 0) {
|
||||
if (!ok) {
|
||||
FREE(shader);
|
||||
shader = NULL;
|
||||
} else {
|
||||
|
|
@ -8011,8 +8011,7 @@ bool si_shader_create(struct si_screen *sscreen, struct ac_llvm_compiler *compil
|
|||
stderr, true);
|
||||
|
||||
/* Upload. */
|
||||
r = si_shader_binary_upload(sscreen, shader);
|
||||
if (r) {
|
||||
if (!si_shader_binary_upload(sscreen, shader)) {
|
||||
fprintf(stderr, "LLVM failed to upload shader\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -690,7 +690,7 @@ void si_shader_destroy(struct si_shader *shader);
|
|||
unsigned si_shader_io_get_unique_index_patch(unsigned semantic_name, unsigned index);
|
||||
unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index,
|
||||
unsigned is_varying);
|
||||
int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);
|
||||
bool si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);
|
||||
void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
|
||||
struct pipe_debug_callback *debug, unsigned processor,
|
||||
FILE *f, bool check_debug_option);
|
||||
|
|
|
|||
|
|
@ -3108,7 +3108,6 @@ static int si_update_scratch_buffer(struct si_context *sctx,
|
|||
struct si_shader *shader)
|
||||
{
|
||||
uint64_t scratch_va = sctx->scratch_buffer->gpu_address;
|
||||
int r;
|
||||
|
||||
if (!shader)
|
||||
return 0;
|
||||
|
|
@ -3139,10 +3138,9 @@ static int si_update_scratch_buffer(struct si_context *sctx,
|
|||
si_shader_apply_scratch_relocs(shader, scratch_va);
|
||||
|
||||
/* Replace the shader bo with a new bo that has the relocs applied. */
|
||||
r = si_shader_binary_upload(sctx->screen, shader);
|
||||
if (r) {
|
||||
if (!si_shader_binary_upload(sctx->screen, shader)) {
|
||||
si_shader_unlock(shader);
|
||||
return r;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Update the shader state to use the new shader bo. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue