From 104dbc64a5f7985d1b0d47db969ed3bb7b9e7b8d Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 13 Mar 2019 15:55:42 +0100 Subject: [PATCH] ac: add ac_build_tbuffer_load_byte() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- 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 195fdcb224d..58e4ffaa2ed 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.30.2