diff options
author | Nicolai Hähnle <[email protected]> | 2017-06-24 20:03:46 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-07-31 14:55:41 +0200 |
commit | a0af3daf9c52757c49b780896dbc33b87108e575 (patch) | |
tree | f90e24f4f88eb22e0de12bcfd695c9c5bfbf821d /src/gallium/drivers/radeonsi/si_shader.c | |
parent | d46018a4d792dbe0c1ba6a74cbd386e378dc6067 (diff) |
radeonsi: implement and use ac_shader_abi::load_ssbo
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index bf66879571a..6b55e7f4f6c 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1806,6 +1806,21 @@ static LLVMValueRef load_ubo(struct ac_shader_abi *abi, LLVMValueRef index) return ac_build_indexed_load_const(&ctx->ac, ptr, index); } +static LLVMValueRef +load_ssbo(struct ac_shader_abi *abi, LLVMValueRef index, bool write) +{ + struct si_shader_context *ctx = si_shader_context_from_abi(abi); + LLVMValueRef rsrc_ptr = LLVMGetParam(ctx->main_fn, + ctx->param_const_and_shader_buffers); + + index = si_llvm_bound_index(ctx, index, ctx->num_shader_buffers); + index = LLVMBuildSub(ctx->gallivm.builder, + LLVMConstInt(ctx->i32, SI_NUM_SHADER_BUFFERS - 1, 0), + index, ""); + + return ac_build_indexed_load_const(&ctx->ac, rsrc_ptr, index); +} + static LLVMValueRef fetch_constant( struct lp_build_tgsi_context *bld_base, const struct tgsi_full_src_register *reg, @@ -5646,6 +5661,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx, } ctx->abi.load_ubo = load_ubo; + ctx->abi.load_ssbo = load_ssbo; create_function(ctx); preload_ring_buffers(ctx); |