r600g/compute: Move compute_shader_create() function into evergreen_compute.c
authorTom Stellard <thomas.stellard@amd.com>
Wed, 12 Jun 2013 19:36:08 +0000 (12:36 -0700)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 28 Jun 2013 15:33:11 +0000 (08:33 -0700)
Tested-by: Aaron Watry <awatry@gmail.com>
src/gallium/drivers/r600/evergreen_compute.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_shader.c

index c993c0959d5e64eee3eea8bf7c511f795230069f..b16c9d933c2ff26eba0abbb42d63f15cf1694b18 100644 (file)
@@ -46,6 +46,7 @@
 #include "evergreen_compute.h"
 #include "evergreen_compute_internal.h"
 #include "compute_memory_pool.h"
+#include "sb/sb_public.h"
 #ifdef HAVE_OPENCL
 #include "radeon_llvm_util.h"
 #endif
@@ -522,7 +523,27 @@ static void evergreen_launch_grid(
        if (!shader->kernels[pc].code_bo) {
                void *p;
                struct r600_kernel *kernel = &shader->kernels[pc];
-               r600_compute_shader_create(ctx_, kernel->llvm_module, &kernel->bc);
+               struct r600_bytecode *bc = &kernel->bc;
+               LLVMModuleRef mod = kernel->llvm_module;
+               boolean use_kill = false;
+               bool dump = (ctx->screen->debug_flags & DBG_CS) != 0;
+               unsigned use_sb = ctx->screen->debug_flags & DBG_SB_CS;
+               unsigned sb_disasm = use_sb ||
+                       (ctx->screen->debug_flags & DBG_SB_DISASM);
+
+               r600_bytecode_init(bc, ctx->chip_class, ctx->family,
+                          ctx->screen->has_compressed_msaa_texturing);
+               bc->type = TGSI_PROCESSOR_COMPUTE;
+               bc->isa = ctx->isa;
+               r600_llvm_compile(mod, ctx->family, bc, &use_kill, dump);
+
+               if (dump && !sb_disasm) {
+                       r600_bytecode_disasm(bc);
+               } else if ((dump && sb_disasm) || use_sb) {
+                       if (r600_sb_bytecode_process(ctx, bc, NULL, dump, use_sb))
+                               R600_ERR("r600_sb_bytecode_process failed!\n");
+               }
+
                kernel->code_bo = r600_compute_buffer_alloc_vram(ctx->screen,
                                                        kernel->bc.ndw * 4);
                p = r600_buffer_mmap_sync_with_rings(ctx, kernel->code_bo, PIPE_TRANSFER_WRITE);
index 1dc346f049fa41297e6f8b280c41e0eef829449c..8485cce732c975050e266345ee64ee0f1130abbb 100644 (file)
@@ -756,10 +756,7 @@ void r600_init_context_resource_functions(struct r600_context *r600);
 int r600_pipe_shader_create(struct pipe_context *ctx,
                            struct r600_pipe_shader *shader,
                            struct r600_shader_key key);
-#ifdef HAVE_OPENCL
-int r600_compute_shader_create(struct pipe_context * ctx,
-       LLVMModuleRef mod,  struct r600_bytecode * bytecode);
-#endif
+
 void r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 
 /* r600_state.c */
index 3a734bc78b785bbe97e47492cd9ead254394320a..3af4ed9328951035351ab8b4d53e93a35c73ed05 100644 (file)
@@ -291,38 +291,6 @@ static int tgsi_bgnloop(struct r600_shader_ctx *ctx);
 static int tgsi_endloop(struct r600_shader_ctx *ctx);
 static int tgsi_loop_brk_cont(struct r600_shader_ctx *ctx);
 
-#ifdef HAVE_OPENCL
-int r600_compute_shader_create(struct pipe_context * ctx,
-       LLVMModuleRef mod,  struct r600_bytecode * bytecode)
-{
-       struct r600_context *r600_ctx = (struct r600_context *)ctx;
-       struct r600_shader_ctx shader_ctx;
-       boolean use_kill = false;
-       bool dump = (r600_ctx->screen->debug_flags & DBG_CS) != 0;
-       unsigned use_sb = r600_ctx->screen->debug_flags & DBG_SB_CS;
-       unsigned sb_disasm = use_sb ||
-                       (r600_ctx->screen->debug_flags & DBG_SB_DISASM);
-
-       shader_ctx.bc = bytecode;
-       r600_bytecode_init(shader_ctx.bc, r600_ctx->chip_class, r600_ctx->family,
-                          r600_ctx->screen->has_compressed_msaa_texturing);
-       shader_ctx.bc->type = TGSI_PROCESSOR_COMPUTE;
-       shader_ctx.bc->isa = r600_ctx->isa;
-       r600_llvm_compile(mod, r600_ctx->family,
-                               shader_ctx.bc, &use_kill, dump);
-
-       if (dump && !sb_disasm) {
-               r600_bytecode_disasm(shader_ctx.bc);
-       } else if ((dump && sb_disasm) || use_sb) {
-               if (r600_sb_bytecode_process(r600_ctx, shader_ctx.bc, NULL, dump, use_sb))
-                       R600_ERR("r600_sb_bytecode_process failed!\n");
-       }
-
-       return 1;
-}
-
-#endif /* HAVE_OPENCL */
-
 static int tgsi_is_supported(struct r600_shader_ctx *ctx)
 {
        struct tgsi_full_instruction *i = &ctx->parse.FullToken.FullInstruction;