From 66461aa249a95053fd5887df75ab791558c3a486 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 6 Feb 2012 15:28:45 +0000 Subject: [PATCH] gallivm: add uint/int bld to the base builder. (v2) 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 --- 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 b03eefc9ee5..a36a09a8fa4 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 53013f75f2e..2c2c820708a 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 5578546089a..bc063253bcd 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; -- 2.30.2