LLVMValueRef coords[5];
struct lp_img_params params;
const struct glsl_type *type = glsl_without_array(var->type);
+ unsigned const_index;
+ LLVMValueRef indir_index;
+ get_deref_offset(bld_base, deref, false, NULL, NULL,
+ &const_index, &indir_index);
memset(¶ms, 0, sizeof(params));
params.target = glsl_sampler_to_pipe(glsl_get_sampler_dim(type), glsl_sampler_type_is_array(type));
params.img_op = LP_IMG_LOAD;
if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_MS)
params.ms_index = get_src(bld_base, instr->src[2]);
- params.image_index = var->data.binding;
+ params.image_index = var->data.binding + (indir_index ? 0 : const_index);
+ params.image_index_offset = indir_index;
bld_base->image_op(bld_base, ¶ms);
}
LLVMValueRef coords[5];
struct lp_img_params params;
const struct glsl_type *type = glsl_without_array(var->type);
+ unsigned const_index;
+ LLVMValueRef indir_index;
+ get_deref_offset(bld_base, deref, false, NULL, NULL,
+ &const_index, &indir_index);
memset(¶ms, 0, sizeof(params));
params.target = glsl_sampler_to_pipe(glsl_get_sampler_dim(type), glsl_sampler_type_is_array(type));
if (glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_MS)
params.ms_index = get_src(bld_base, instr->src[2]);
params.img_op = LP_IMG_STORE;
- params.image_index = var->data.binding;
+ params.image_index = var->data.binding + (indir_index ? 0 : const_index);
+ params.image_index_offset = indir_index;
if (params.target == PIPE_TEXTURE_1D_ARRAY)
coords[2] = coords[1];
LLVMValueRef in_val = get_src(bld_base, instr->src[3]);
LLVMValueRef coords[5];
const struct glsl_type *type = glsl_without_array(var->type);
+ unsigned const_index;
+ LLVMValueRef indir_index;
+ get_deref_offset(bld_base, deref, false, NULL, NULL,
+ &const_index, &indir_index);
memset(¶ms, 0, sizeof(params));
params.outdata = result;
params.img_op = (instr->intrinsic == nir_intrinsic_image_deref_atomic_comp_swap) ? LP_IMG_ATOMIC_CAS : LP_IMG_ATOMIC;
- params.image_index = var->data.binding;
+ params.image_index = var->data.binding + (indir_index ? 0 : const_index);
+ params.image_index_offset = indir_index;
bld_base->image_op(bld_base, ¶ms);
}
nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr);
nir_variable *var = nir_deref_instr_get_variable(deref);
struct lp_sampler_size_query_params params = { 0 };
- params.texture_unit = var->data.binding;
- params.target = glsl_sampler_to_pipe(glsl_get_sampler_dim(var->type), glsl_sampler_type_is_array(var->type));
+ unsigned const_index;
+ LLVMValueRef indir_index;
+ const struct glsl_type *type = glsl_without_array(var->type);
+ get_deref_offset(bld_base, deref, false, NULL, NULL,
+ &const_index, &indir_index);
+ params.texture_unit = var->data.binding + (indir_index ? 0 : const_index);
+ params.texture_unit_offset = indir_index;
+ params.target = glsl_sampler_to_pipe(glsl_get_sampler_dim(type), glsl_sampler_type_is_array(type));
params.sizes_out = result;
bld_base->image_size(bld_base, ¶ms);
nir_deref_instr *deref = nir_instr_as_deref(instr->src[0].ssa->parent_instr);
nir_variable *var = nir_deref_instr_get_variable(deref);
struct lp_sampler_size_query_params params = { 0 };
- params.texture_unit = var->data.binding;
- params.target = glsl_sampler_to_pipe(glsl_get_sampler_dim(var->type), glsl_sampler_type_is_array(var->type));
+ unsigned const_index;
+ LLVMValueRef indir_index;
+ const struct glsl_type *type = glsl_without_array(var->type);
+ get_deref_offset(bld_base, deref, false, NULL, NULL,
+ &const_index, &indir_index);
+
+ params.texture_unit = var->data.binding + (indir_index ? 0 : const_index);
+ params.texture_unit_offset = indir_index;
+ params.target = glsl_sampler_to_pipe(glsl_get_sampler_dim(type), glsl_sampler_type_is_array(type));
params.sizes_out = result;
params.samples_only = true;
struct lp_img_params *params)
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
+ struct gallivm_state *gallivm = bld_base->base.gallivm;
+
params->type = bld_base->base.type;
params->context_ptr = bld->context_ptr;
params->thread_data_ptr = bld->thread_data_ptr;
params->exec_mask = mask_vec(bld_base);
+
+ if (params->image_index_offset)
+ params->image_index_offset = LLVMBuildExtractElement(gallivm->builder, params->image_index_offset,
+ lp_build_const_int32(gallivm, 0), "");
+
bld->image->emit_op(bld->image,
bld->bld_base.base.gallivm,
params);
struct lp_sampler_size_query_params *params)
{
struct lp_build_nir_soa_context *bld = (struct lp_build_nir_soa_context *)bld_base;
+ struct gallivm_state *gallivm = bld_base->base.gallivm;
params->int_type = bld_base->int_bld.type;
params->context_ptr = bld->context_ptr;
+ if (params->texture_unit_offset)
+ params->texture_unit_offset = LLVMBuildExtractElement(gallivm->builder, params->texture_unit_offset,
+ lp_build_const_int32(gallivm, 0), "");
bld->image->emit_size_query(bld->image,
bld->bld_base.base.gallivm,
params);