summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/radeon_llvm.h
diff options
context:
space:
mode:
authorChristian König <[email protected]>2013-03-07 11:01:07 +0100
committerChristian König <[email protected]>2013-03-19 15:16:18 +0100
commitc05483fc00a0630aba86ad9de68d949bbb68f8c9 (patch)
tree9d442a8cb08310b41437162ee6f2e7e1ba9ccd06 /src/gallium/drivers/radeon/radeon_llvm.h
parentb51f8593d85fe35b1fd7bf76447a6f380d210c69 (diff)
radeon/llvm: rework input fetch and output store
Cleanup the code and implement indirect addressing. Signed-off-by: Christian König <[email protected]> Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon/radeon_llvm.h')
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gallium/drivers/radeon/radeon_llvm.h b/src/gallium/drivers/radeon/radeon_llvm.h
index 4c01d682254..1d4bd456670 100644
--- a/src/gallium/drivers/radeon/radeon_llvm.h
+++ b/src/gallium/drivers/radeon/radeon_llvm.h
@@ -35,6 +35,7 @@
#define RADEON_LLVM_MAX_OUTPUTS 32 * 4
#define RADEON_LLVM_MAX_BRANCH_DEPTH 16
#define RADEON_LLVM_MAX_LOOP_DEPTH 16
+#define RADEON_LLVM_MAX_ARRAYS 16
#define RADEON_LLVM_MAX_SYSTEM_VALUES 4
@@ -117,35 +118,40 @@ struct radeon_llvm_context {
unsigned branch_depth;
unsigned loop_depth;
+ struct tgsi_declaration_range arrays[RADEON_LLVM_MAX_ARRAYS];
+ unsigned num_arrays;
LLVMValueRef main_fn;
struct gallivm_state gallivm;
};
-static inline LLVMValueRef bitcast(
+static inline LLVMTypeRef tgsi2llvmtype(
struct lp_build_tgsi_context * bld_base,
- enum tgsi_opcode_type type,
- LLVMValueRef value
-)
+ enum tgsi_opcode_type type)
{
- LLVMBuilderRef builder = bld_base->base.gallivm->builder;
LLVMContextRef ctx = bld_base->base.gallivm->context;
- LLVMTypeRef dst_type;
switch (type) {
case TGSI_TYPE_UNSIGNED:
case TGSI_TYPE_SIGNED:
- dst_type = LLVMInt32TypeInContext(ctx);
- break;
+ return LLVMInt32TypeInContext(ctx);
case TGSI_TYPE_UNTYPED:
case TGSI_TYPE_FLOAT:
- dst_type = LLVMFloatTypeInContext(ctx);
- break;
- default:
- dst_type = 0;
- break;
+ return LLVMFloatTypeInContext(ctx);
+ default: break;
}
+ return 0;
+}
+
+static inline LLVMValueRef bitcast(
+ struct lp_build_tgsi_context * bld_base,
+ enum tgsi_opcode_type type,
+ LLVMValueRef value
+)
+{
+ LLVMBuilderRef builder = bld_base->base.gallivm->builder;
+ LLVMTypeRef dst_type = tgsi2llvmtype(bld_base, type);
if (dst_type)
return LLVMBuildBitCast(builder, value, dst_type, "");