radeonsi: move si_shader_binary_upload out of si_compile_llvm
authorMarek Olšák <marek.olsak@amd.com>
Sun, 27 Dec 2015 22:47:00 +0000 (23:47 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 7 Jan 2016 17:26:06 +0000 (18:26 +0100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_compute.c
src/gallium/drivers/radeonsi/si_shader.c

index a543c55221b83507456d482a4b76b2a1f0dcca8f..aedea8e43ee66676b7280f938c29d8b7bc838cab 100644 (file)
@@ -124,6 +124,7 @@ static void *si_create_compute_state(
                                                         code, header->num_bytes);
                        si_compile_llvm(sctx->screen, &program->kernels[i], sctx->tm,
                                        mod, &sctx->b.debug, TGSI_PROCESSOR_COMPUTE);
+                       si_shader_binary_upload(sctx->screen, &program->kernels[i]);
                        LLVMDisposeModule(mod);
                }
        }
index bcc9f658a7b2168400ccede5d424d8ae7cf9b0b1..2a206dd62908f03ec07d16d6d3e1dcd4f087d9cb 100644 (file)
@@ -3902,10 +3902,6 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
        si_shader_binary_read(sscreen, &shader->binary, &shader->config,
                              debug, processor);
 
-       r = si_shader_binary_upload(sscreen, shader);
-       if (r)
-               return r;
-
        FREE(shader->binary.config);
        FREE(shader->binary.global_symbol_offsets);
        shader->binary.config = NULL;
@@ -3986,6 +3982,8 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen,
        r = si_compile_llvm(sscreen, si_shader_ctx->shader,
                            si_shader_ctx->tm, bld_base->base.gallivm->module,
                            debug, TGSI_PROCESSOR_GEOMETRY);
+       if (!r)
+               r = si_shader_binary_upload(sscreen, si_shader_ctx->shader);
 
        radeon_llvm_dispose(&si_shader_ctx->radeon_bld);
 
@@ -4186,6 +4184,12 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
                goto out;
        }
 
+       r = si_shader_binary_upload(sscreen, shader);
+       if (r) {
+               fprintf(stderr, "LLVM failed to upload shader\n");
+               goto out;
+       }
+
        radeon_llvm_dispose(&si_shader_ctx.radeon_bld);
 
        if (si_shader_ctx.type == TGSI_PROCESSOR_GEOMETRY) {