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);
}
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;
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,
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;
align(bo_size, SI_CPDMA_ALIGNMENT),
256);
if (!shader->bo)
- return -ENOMEM;
+ return false;
/* Upload. */
ptr = sscreen->ws->buffer_map(shader->bo->buf, NULL,
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,
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);
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 {
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;
}
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);
struct si_shader *shader)
{
uint64_t scratch_va = sctx->scratch_buffer->gpu_address;
- int r;
if (!shader)
return 0;
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. */