summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2016-04-18 13:10:10 -0400
committerTom Stellard <[email protected]>2016-04-22 23:45:34 +0000
commitb31422d970848c4f0925bdd83850393fa3f0ab8c (patch)
treece1b2eff7d93256dd6c8a4d93e311c1ab92c342f /src/gallium/drivers/radeonsi
parent86cd9a134f8d6db5c65268f4ca89a919be17689b (diff)
radeonsi: Create a helper function for computing the thread id
Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index c6efbc13774..a8749e4ee94 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1116,6 +1116,14 @@ static LLVMValueRef get_sample_id(struct radeon_llvm_context *radeon_bld)
SI_PARAM_ANCILLARY, 8, 4);
}
+static LLVMValueRef get_thread_id(struct si_shader_context *ctx)
+{
+ struct gallivm_state *gallivm = &ctx->radeon_bld.gallivm;
+
+ return lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", ctx->i32,
+ NULL, 0, LLVMReadNoneAttribute);
+}
+
/**
* Load a dword from a constant buffer.
*/
@@ -1863,8 +1871,7 @@ static void si_llvm_emit_streamout(struct si_shader_context *ctx,
LLVMValueRef so_vtx_count =
unpack_param(ctx, ctx->param_streamout_config, 16, 7);
- LLVMValueRef tid = lp_build_intrinsic(builder, "llvm.SI.tid", ctx->i32,
- NULL, 0, LLVMReadNoneAttribute);
+ LLVMValueRef tid = get_thread_id(ctx);
/* can_emit = tid < so_vtx_count; */
LLVMValueRef can_emit =
@@ -4365,8 +4372,7 @@ static void si_llvm_emit_ddxy(
unsigned mask;
indices[0] = bld_base->uint_bld.zero;
- indices[1] = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", ctx->i32,
- NULL, 0, LLVMReadNoneAttribute);
+ indices[1] = get_thread_id(ctx);
store_ptr = LLVMBuildGEP(gallivm->builder, ctx->lds,
indices, 2, "");
@@ -4437,8 +4443,7 @@ static LLVMValueRef si_llvm_emit_ddxy_interp(
unsigned c;
indices[0] = bld_base->uint_bld.zero;
- indices[1] = lp_build_intrinsic(gallivm->builder, "llvm.SI.tid", ctx->i32,
- NULL, 0, LLVMReadNoneAttribute);
+ indices[1] = get_thread_id(ctx);
store_ptr = LLVMBuildGEP(gallivm->builder, ctx->lds,
indices, 2, "");