summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_shader.c
diff options
context:
space:
mode:
authorAdam Rak <[email protected]>2011-11-30 22:20:41 +0100
committerTom Stellard <[email protected]>2012-06-01 11:28:10 -0400
commit6a829a1b724ca0d960decee217d260b4de8a5463 (patch)
tree0bc6a96e7a7151ba50aa391e94ca6f0adfc37376 /src/gallium/drivers/r600/r600_shader.c
parent46a13b3b11d859e131399853c11ae2be0eb02f0a (diff)
r600g: compute support for evergreen
Tom Stellard: - Updated for gallium interface changes - Fixed a few bugs: + Set the loop counter + Calculate the correct number of pipes - Added hooks into the LLVM compiler
Diffstat (limited to 'src/gallium/drivers/r600/r600_shader.c')
-rw-r--r--src/gallium/drivers/r600/r600_shader.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index dc208b923cb..5f3c76eafbb 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -225,6 +225,37 @@ static int tgsi_loop_brk_cont(struct r600_shader_ctx *ctx);
* struct r600_bytecode.
*/
+static void r600_bytecode_from_byte_stream(struct r600_shader_ctx *ctx,
+ unsigned char * bytes, unsigned num_bytes);
+
+#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;
+ unsigned char * bytes;
+ unsigned byte_count;
+ struct r600_shader_ctx shader_ctx;
+ unsigned dump = 0;
+
+ if (debug_get_bool_option("R600_DUMP_SHADERS", FALSE)) {
+ dump = 1;
+ }
+
+ r600_llvm_compile(mod, &bytes, &byte_count, r600_ctx->family , dump);
+ shader_ctx.bc = bytecode;
+ r600_bytecode_init(shader_ctx.bc, r600_ctx->chip_class, r600_ctx->family);
+ shader_ctx.bc->type = TGSI_PROCESSOR_COMPUTE;
+ r600_bytecode_from_byte_stream(&shader_ctx, bytes, byte_count);
+ r600_bytecode_build(shader_ctx.bc);
+ if (dump) {
+ r600_bytecode_dump(shader_ctx.bc);
+ }
+ return 1;
+}
+
+#endif /* HAVE_OPENCL */
+
static unsigned r600_src_from_byte_stream(unsigned char * bytes,
unsigned bytes_read, struct r600_bytecode_alu * alu, unsigned src_idx)
{