radeonsi/nir: tidy up si_nir_load_sampler_desc()

This makes it easier to follow the code, and also initialises
dynamic_index which will be useful for adding bindless textures
support.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Timothy Arceri 2018-03-22 11:55:20 +11:00
parent d7cbe795ed
commit 494a5c3501
1 changed files with 3 additions and 5 deletions

View File

@ -885,14 +885,12 @@ si_nir_load_sampler_desc(struct ac_shader_abi *abi,
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
LLVMBuilderRef builder = ctx->ac.builder;
LLVMValueRef list = LLVMGetParam(ctx->main_fn, ctx->param_samplers_and_images);
LLVMValueRef index = dynamic_index;
LLVMValueRef index;
assert(!descriptor_set);
if (!index)
index = ctx->ac.i32_0;
index = LLVMBuildAdd(builder, index,
dynamic_index = dynamic_index ? dynamic_index : ctx->ac.i32_0;
index = LLVMBuildAdd(builder, dynamic_index,
LLVMConstInt(ctx->ac.i32, base_index + constant_index, false),
"");