Mesa (master): gallivm: add lp_build_emit_fetch_src() helper
Samuel Pitoiset
hakzsam at kemper.freedesktop.org
Sat Apr 1 16:10:07 UTC 2017
Module: Mesa
Branch: master
Commit: 8a3ef8c65d9125012d32522eef58e5fc5c0b086a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a3ef8c65d9125012d32522eef58e5fc5c0b086a
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Thu Mar 30 19:57:43 2017 +0200
gallivm: add lp_build_emit_fetch_src() helper
lp_build_emit_fetch() is useful when the source type can be
infered from the instruction opcode.
However, for bindless samplers/images we can't do that easily
because tgsi_opcode_infer_src_type() returns TGSI_TYPE_FLOAT for
TEX instructions, while we need TGSI_TYPE_UNSIGNED64 if the
resource register is bindless.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/auxiliary/gallivm/lp_bld_tgsi.c | 22 +++++++++++++++++-----
src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 7 +++++++
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index d368f38d09..69863ab93c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -323,16 +323,14 @@ lp_build_tgsi_inst_llvm(
LLVMValueRef
-lp_build_emit_fetch(
+lp_build_emit_fetch_src(
struct lp_build_tgsi_context *bld_base,
- const struct tgsi_full_instruction *inst,
- unsigned src_op,
+ const struct tgsi_full_src_register *reg,
+ enum tgsi_opcode_type stype,
const unsigned chan_index)
{
- const struct tgsi_full_src_register *reg = &inst->Src[src_op];
unsigned swizzle;
LLVMValueRef res;
- enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(inst->Instruction.Opcode);
if (chan_index == LP_CHAN_ALL) {
swizzle = ~0u;
@@ -413,7 +411,21 @@ lp_build_emit_fetch(
}
return res;
+}
+
+
+LLVMValueRef
+lp_build_emit_fetch(
+ struct lp_build_tgsi_context *bld_base,
+ const struct tgsi_full_instruction *inst,
+ unsigned src_op,
+ const unsigned chan_index)
+{
+ const struct tgsi_full_src_register *reg = &inst->Src[src_op];
+ enum tgsi_opcode_type stype =
+ tgsi_opcode_infer_src_type(inst->Instruction.Opcode);
+ return lp_build_emit_fetch_src(bld_base, reg, stype, chan_index);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index a9f3d449e7..eb632b700a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -643,6 +643,13 @@ lp_build_tgsi_inst_llvm(
const struct tgsi_full_instruction *inst);
LLVMValueRef
+lp_build_emit_fetch_src(
+ struct lp_build_tgsi_context *bld_base,
+ const struct tgsi_full_src_register *reg,
+ enum tgsi_opcode_type stype,
+ const unsigned chan_index);
+
+LLVMValueRef
lp_build_emit_fetch(
struct lp_build_tgsi_context *bld_base,
const struct tgsi_full_instruction *inst,
More information about the mesa-commit
mailing list