Mesa (master): ac: add ac_build_tbuffer_store_byte() helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 21 08:01:22 UTC 2019


Module: Mesa
Branch: master
Commit: b235d77e1820ed235e8055393a629aef45ba071c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b235d77e1820ed235e8055393a629aef45ba071c

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Mar 13 16:08:32 2019 +0100

ac: add ac_build_tbuffer_store_byte() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/common/ac_llvm_build.c | 19 +++++++++++++++++++
 src/amd/common/ac_llvm_build.h |  9 +++++++++
 2 files changed, 28 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 58e4ffaa2ed..b5bb399eef1 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1771,6 +1771,25 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx,
 				   writeonly_memory);
 }
 
+void
+ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx,
+			    LLVMValueRef rsrc,
+			    LLVMValueRef vdata,
+			    LLVMValueRef voffset,
+			    LLVMValueRef soffset,
+			    bool glc,
+			    bool writeonly_memory)
+{
+	unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
+	unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
+
+	vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i8, "");
+	vdata = LLVMBuildZExt(ctx->builder, vdata, ctx->i32, "");
+
+	ac_build_raw_tbuffer_store(ctx, rsrc, vdata, voffset, soffset,
+				   ctx->i32_0, 1, dfmt, nfmt, glc, false,
+				   writeonly_memory);
+}
 /**
  * Set range metadata on an instruction.  This can only be used on load and
  * call instructions.  If you know an instruction can only produce the values
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 0162986e454..aa6e913c6c6 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -363,6 +363,15 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx,
 			     bool writeonly_memory);
 
 void
+ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx,
+			    LLVMValueRef rsrc,
+			    LLVMValueRef vdata,
+			    LLVMValueRef voffset,
+			    LLVMValueRef soffset,
+			    bool glc,
+			    bool writeonly_memory);
+
+void
 ac_build_struct_tbuffer_store(struct ac_llvm_context *ctx,
 			      LLVMValueRef rsrc,
 			      LLVMValueRef vdata,




More information about the mesa-commit mailing list