summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-05-20 17:19:50 +0200
committerNicolai Hähnle <[email protected]>2017-07-31 14:55:36 +0200
commitd007919d999c812bbef481f0605c64f7e0f225b7 (patch)
tree710af1d089144ca32bf05feb43b164c1201cf11d /src/gallium/drivers
parent220ed150bcaa7b2ecfc169a0016b68933d3be8d4 (diff)
ac/nir,radeonsi: add ac_shader_abi::load_ubo
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 900b3c3a7f1..0d25773cc3d 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1776,6 +1776,18 @@ static LLVMValueRef load_const_buffer_desc(struct si_shader_context *ctx, int i)
LLVMConstInt(ctx->i32, si_get_constbuf_slot(i), 0));
}
+static LLVMValueRef load_ubo(struct ac_shader_abi *abi, LLVMValueRef index)
+{
+ struct si_shader_context *ctx = si_shader_context_from_abi(abi);
+ LLVMValueRef ptr = LLVMGetParam(ctx->main_fn, ctx->param_const_and_shader_buffers);
+
+ index = si_llvm_bound_index(ctx, index, ctx->num_const_buffers);
+ index = LLVMBuildAdd(ctx->gallivm.builder, index,
+ LLVMConstInt(ctx->i32, SI_NUM_SHADER_BUFFERS, 0), "");
+
+ return ac_build_indexed_load_const(&ctx->ac, ptr, index);
+}
+
static LLVMValueRef fetch_constant(
struct lp_build_tgsi_context *bld_base,
const struct tgsi_full_src_register *reg,
@@ -5609,6 +5621,8 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
return false;
}
+ ctx->abi.load_ubo = load_ubo;
+
create_function(ctx);
preload_ring_buffers(ctx);