From 21190fbd56ec2f12dc5a1bf1d9fc32d507e8f0a3 Mon Sep 17 00:00:00 2001 From: Christian König Date: Thu, 7 Mar 2013 15:02:31 +0100 Subject: tgsi: use separate structure for indirect address v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To further improve the optimization of source and destination indirect addressing we need the ability to store a reference to the declaration of the addressed operands. Since most of the fields in tgsi_src_register doesn't apply for an indirect addressing operand replace it with a separate tgsi_ind_register structure and so make room for extra information. v2: rename Declaration to ArrayID, put the ArrayID into () instead of [] Signed-off-by: Christian König --- src/gallium/drivers/i915/i915_fpc.h | 8 ++++---- src/gallium/drivers/nv30/nvfx_vertprog.c | 2 +- src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp | 6 ++++++ src/gallium/drivers/r600/r600_llvm.c | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/i915/i915_fpc.h b/src/gallium/drivers/i915/i915_fpc.h index 9e4a7ea0e4a..e915822f4a9 100644 --- a/src/gallium/drivers/i915/i915_fpc.h +++ b/src/gallium/drivers/i915/i915_fpc.h @@ -276,9 +276,9 @@ struct i915_full_dst_register { struct i915_dst_register Register; /* - struct tgsi_src_register Indirect; + struct tgsi_ind_register Indirect; struct tgsi_dimension Dimension; - struct tgsi_src_register DimIndirect; + struct tgsi_ind_register DimIndirect; */ }; @@ -286,9 +286,9 @@ struct i915_full_src_register { struct i915_src_register Register; /* - struct tgsi_src_register Indirect; + struct tgsi_ind_register Indirect; struct tgsi_dimension Dimension; - struct tgsi_src_register DimIndirect; + struct tgsi_ind_register DimIndirect; */ }; diff --git a/src/gallium/drivers/nv30/nvfx_vertprog.c b/src/gallium/drivers/nv30/nvfx_vertprog.c index 827d518cb54..74dba38001c 100644 --- a/src/gallium/drivers/nv30/nvfx_vertprog.c +++ b/src/gallium/drivers/nv30/nvfx_vertprog.c @@ -405,7 +405,7 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) { fsrc->Register.File == TGSI_FILE_INPUT)) { src.indirect = 1; src.indirect_reg = fsrc->Indirect.Index; - src.indirect_swz = fsrc->Indirect.SwizzleX; + src.indirect_swz = fsrc->Indirect.Swizzle; } else { src.reg.index = 0; src.reg.type = -1; diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp index a3830ed3c2a..613187c0a12 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp @@ -23,6 +23,7 @@ extern "C" { #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_scan.h" +#include "tgsi/tgsi_util.h" } #include @@ -55,6 +56,11 @@ public: SrcRegister(const struct tgsi_src_register& src) : reg(src), fsr(NULL) { } + SrcRegister(const struct tgsi_ind_register& ind) + : reg(tgsi_util_get_src_from_ind(&ind)), + fsr(NULL) + { } + struct tgsi_src_register offsetToSrc(struct tgsi_texture_offset off) { struct tgsi_src_register reg; diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index 042193c990b..6e6edb77c66 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -34,7 +34,7 @@ static LLVMValueRef llvm_fetch_const( }; if (reg->Register.Indirect) { struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base); - LLVMValueRef index = LLVMBuildLoad(bld_base->base.gallivm->builder, bld->addr[reg->Indirect.Index][reg->Indirect.SwizzleX], ""); + LLVMValueRef index = LLVMBuildLoad(bld_base->base.gallivm->builder, bld->addr[reg->Indirect.Index][reg->Indirect.Swizzle], ""); offset[1] = LLVMBuildAdd(bld_base->base.gallivm->builder, offset[1], index, ""); } unsigned ConstantAddressSpace = CONSTANT_BUFFER_0_ADDR_SPACE ; -- cgit v1.2.3