[Mesa-dev] [PATCH 2/8] ac: add ac_build_tbuffer_load_byte() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Mar 19 08:31:09 UTC 2019


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/common/ac_llvm_build.c | 18 ++++++++++++++++++
 src/amd/common/ac_llvm_build.h |  8 ++++++++
 2 files changed, 26 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index c5f1c85f269..d52f1b3f42d 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1606,6 +1606,24 @@ ac_build_tbuffer_load_short(struct ac_llvm_context *ctx,
 	return LLVMBuildTrunc(ctx->builder, res, ctx->i16, "");
 }
 
+LLVMValueRef
+ac_build_tbuffer_load_byte(struct ac_llvm_context *ctx,
+			   LLVMValueRef rsrc,
+			   LLVMValueRef voffset,
+			   LLVMValueRef soffset,
+			   LLVMValueRef immoffset,
+			   bool glc)
+{
+	unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
+	unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
+	LLVMValueRef res;
+
+	res = ac_build_raw_tbuffer_load(ctx, rsrc, voffset, soffset,
+					immoffset, 1, dfmt, nfmt, glc, false,
+					false);
+
+	return LLVMBuildTrunc(ctx->builder, res, ctx->i8, "");
+}
 static void
 ac_build_llvm8_tbuffer_store(struct ac_llvm_context *ctx,
 			     LLVMValueRef rsrc,
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index f6bf473f6a1..0162986e454 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -318,6 +318,14 @@ ac_build_tbuffer_load_short(struct ac_llvm_context *ctx,
 			    LLVMValueRef immoffset,
 			    bool glc);
 
+LLVMValueRef
+ac_build_tbuffer_load_byte(struct ac_llvm_context *ctx,
+			   LLVMValueRef rsrc,
+			   LLVMValueRef voffset,
+			   LLVMValueRef soffset,
+			   LLVMValueRef immoffset,
+			   bool glc);
+
 LLVMValueRef
 ac_build_struct_tbuffer_load(struct ac_llvm_context *ctx,
 			     LLVMValueRef rsrc,
-- 
2.21.0



More information about the mesa-dev mailing list