[Mesa-dev] [PATCH 4/9] gallivm: add uint/int bld to the base builder. (v2)
Dave Airlie
airlied at gmail.com
Wed Feb 8 04:17:52 PST 2012
From: Dave Airlie <airlied at redhat.com>
These are used inside the action handlers for the integer opcodes.
v2: use uint_bld/int_bld, drop higher level uint_bld.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 6 +++---
src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c | 2 ++
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 13 +++++++------
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index b03eefc..a36a09a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -279,6 +279,9 @@ struct lp_build_tgsi_context
{
struct lp_build_context base;
+ struct lp_build_context uint_bld;
+ struct lp_build_context int_bld;
+
/** This array stores functions that are used to transform TGSI opcodes to
* LLVM instructions.
*/
@@ -338,9 +341,6 @@ struct lp_build_tgsi_soa_context
{
struct lp_build_tgsi_context bld_base;
- /* Builder for vector integer masks and indices */
- struct lp_build_context uint_bld;
-
/* Builder for scalar elements of shader's data type (float) */
struct lp_build_context elem_bld;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
index 53013f7..2c2c820 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -991,6 +991,8 @@ lp_build_tgsi_aos(struct gallivm_state *gallivm,
/* Setup build context */
memset(&bld, 0, sizeof bld);
lp_build_context_init(&bld.bld_base.base, gallivm, type);
+ lp_build_context_init(&bld.bld_base.uint_bld, gallivm, lp_uint_type(type));
+ lp_build_context_init(&bld.bld_base.int_bld, gallivm, lp_int_type(type));
lp_build_context_init(&bld.int_bld, gallivm, lp_int_type(type));
for (chan = 0; chan < 4; ++chan) {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 5578546..bc06325 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -485,7 +485,7 @@ get_indirect_index(struct lp_build_tgsi_soa_context *bld,
const struct tgsi_src_register *indirect_reg)
{
LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder;
- struct lp_build_context *uint_bld = &bld->uint_bld;
+ struct lp_build_context *uint_bld = &bld->bld_base.uint_bld;
/* always use X component of address register */
unsigned swizzle = indirect_reg->SwizzleX;
LLVMValueRef base;
@@ -528,7 +528,7 @@ emit_fetch_constant(
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
- struct lp_build_context *uint_bld = &bld->uint_bld;
+ struct lp_build_context *uint_bld = &bld_base->uint_bld;
LLVMValueRef indirect_index = NULL;
/* XXX: Handle fetching xyzw components as a vector */
@@ -588,7 +588,7 @@ emit_fetch_input(
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
- struct lp_build_context *uint_bld = &bld->uint_bld;
+ struct lp_build_context *uint_bld = &bld_base->uint_bld;
LLVMValueRef indirect_index = NULL;
LLVMValueRef res;
@@ -645,7 +645,7 @@ emit_fetch_temporary(
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
- struct lp_build_context *uint_bld = &bld->uint_bld;
+ struct lp_build_context *uint_bld = &bld_base->uint_bld;
LLVMValueRef indirect_index = NULL;
LLVMValueRef res;
@@ -820,7 +820,7 @@ emit_store_chan(
struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
const struct tgsi_full_dst_register *reg = &inst->Dst[index];
- struct lp_build_context *uint_bld = &bld->uint_bld;
+ struct lp_build_context *uint_bld = &bld_base->uint_bld;
LLVMValueRef indirect_index = NULL;
struct lp_build_context *bld_store;
@@ -1758,7 +1758,8 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
/* Setup build context */
memset(&bld, 0, sizeof bld);
lp_build_context_init(&bld.bld_base.base, gallivm, type);
- lp_build_context_init(&bld.uint_bld, gallivm, lp_uint_type(type));
+ lp_build_context_init(&bld.bld_base.uint_bld, gallivm, lp_uint_type(type));
+ lp_build_context_init(&bld.bld_base.int_bld, gallivm, lp_int_type(type));
lp_build_context_init(&bld.elem_bld, gallivm, lp_elem_type(type));
bld.mask = mask;
bld.pos = pos;
--
1.7.7.6
More information about the mesa-dev
mailing list