Mesa (master): radeonsi: use the ac helper for image stores

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 12 00:05:40 UTC 2019


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Jun  3 16:35:37 2019 -0400

radeonsi: use the ac helper for image stores

---

 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 35 ++++-------------------
 1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
index 896f51f7fed..2cf1f902cee 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
@@ -723,36 +723,13 @@ static void store_emit(
 
 	if (target == TGSI_TEXTURE_BUFFER) {
 		unsigned num_channels = util_last_bit(inst->Dst[0].Register.WriteMask);
-		num_channels = util_next_power_of_two(num_channels);
-
-		LLVMValueRef buf_args[6] = {
-			ac_build_gather_values(&ctx->ac, chans, 4),
-			args.resource,
-			vindex,
-			ctx->i32_0, /* voffset */
-		};
-
-		if (HAVE_LLVM >= 0x0800) {
-			buf_args[4] = ctx->i32_0; /* soffset */
-			buf_args[5] = LLVMConstInt(ctx->i1, args.cache_policy, 0);
-		} else {
-			buf_args[4] = LLVMConstInt(ctx->i1, !!(args.cache_policy & ac_glc), 0);
-			buf_args[5] = LLVMConstInt(ctx->i1, !!(args.cache_policy & ac_slc), 0);
-		}
-
-		const char *types[] = { "f32", "v2f32", "v4f32" };
-		char name[128];
 
-		snprintf(name, sizeof(name), "%s.%s",
-			 HAVE_LLVM >= 0x0800 ? "llvm.amdgcn.struct.buffer.store.format" :
-					       "llvm.amdgcn.buffer.store.format",
-			 types[CLAMP(num_channels, 1, 3) - 1]);
-
-		emit_data->output[emit_data->chan] = ac_build_intrinsic(
-			&ctx->ac,
-			name,
-			ctx->voidt, buf_args, 6,
-			ac_get_store_intr_attribs(writeonly_memory));
+		ac_build_buffer_store_format(&ctx->ac, args.resource,
+					     ac_build_gather_values(&ctx->ac, chans, num_channels),
+					     vindex, ctx->i32_0 /* voffset */,
+					     num_channels,
+					     !!(args.cache_policy & ac_glc),
+					     writeonly_memory);
 	} else {
 		args.opcode = ac_image_store;
 		args.data[0] = ac_build_gather_values(&ctx->ac, chans, 4);




More information about the mesa-commit mailing list