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;
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;
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) {
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;
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;
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);
si_calculate_max_simd_waves(shader);
si_shader_dump_stats_for_shader_db(sscreen, shader, debug);
- return 0;
+ return true;
}
/**
{
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.
/* 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:
};
/* 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,
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;
}
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;