summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
authorVincent Lejeune <[email protected]>2013-02-14 17:26:30 +0100
committerVincent Lejeune <[email protected]>2013-02-18 15:08:59 +0100
commit0527317e1f89ce6cb7ba4193a9196c880d223e59 (patch)
treed98d26077b9d332299c9223b1c6ff203a67bc6ac /src/gallium/drivers/r600
parentc116598f863db2e580ccb7c7a0613f2541cc0fea (diff)
r600g/llvm: Support for TBO
Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/r600_llvm.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index 59047e7779b..aee7cea0d5a 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -412,6 +412,34 @@ static void llvm_emit_tex(
LLVMValueRef args[6];
unsigned c, sampler_src;
+ if (emit_data->inst->Texture.Texture == TGSI_TEXTURE_BUFFER) {
+ switch (emit_data->inst->Instruction.Opcode) {
+ case TGSI_OPCODE_TXQ: {
+ LLVMValueRef offset[2] = {
+ LLVMConstInt(LLVMInt64TypeInContext(bld_base->base.gallivm->context), 0, false),
+ lp_build_const_int32(bld_base->base.gallivm, 1)
+ };
+ LLVMTypeRef const_ptr_type = LLVMPointerType(LLVMArrayType(LLVMVectorType(bld_base->base.elem_type, 4), 1024),
+ R600_BUFFER_INFO_CONST_BUFFER);
+ LLVMValueRef const_ptr = LLVMBuildIntToPtr(bld_base->base.gallivm->builder, lp_build_const_int32(bld_base->base.gallivm, 0), const_ptr_type, "");
+ LLVMValueRef ptr = LLVMBuildGEP(bld_base->base.gallivm->builder, const_ptr, offset, 2, "");
+ LLVMValueRef cvecval = LLVMBuildLoad(bld_base->base.gallivm->builder, ptr, "");
+ emit_data->output[0] = cvecval;
+ return;
+ }
+ case TGSI_OPCODE_TXF: {
+ args[0] = LLVMBuildExtractElement(gallivm->builder, emit_data->args[0], lp_build_const_int32(gallivm, 0), "");
+ args[1] = lp_build_const_int32(gallivm, R600_MAX_CONST_BUFFERS);
+ emit_data->output[0] = build_intrinsic(gallivm->builder,
+ "llvm.R600.load.texbuf",
+ emit_data->dst_type, args, 2, LLVMReadNoneAttribute);
+ }
+ return;
+ default:
+ break;
+ }
+ }
+
assert(emit_data->arg_count + 2 <= Elements(args));
for (c = 0; c < emit_data->arg_count; ++c)