struct lp_sampler_size_query_params params = { 0 };
LLVMValueRef sizes_out[NIR_MAX_VEC_COMPONENTS];
LLVMValueRef explicit_lod = NULL;
-
+ LLVMValueRef texture_unit_offset = NULL;
for (unsigned i = 0; i < instr->num_srcs; i++) {
switch (instr->src[i].src_type) {
case nir_tex_src_lod:
explicit_lod = cast_type(bld_base, get_src(bld_base, instr->src[i].src), nir_type_int, 32);
break;
+ case nir_tex_src_texture_offset:
+ texture_unit_offset = get_src(bld_base, instr->src[i].src);
+ break;
default:
break;
}
params.is_sviewinfo = TRUE;
params.sizes_out = sizes_out;
params.samples_only = (instr->op == nir_texop_texture_samples);
+ params.texture_unit_offset = texture_unit_offset;
if (instr->op == nir_texop_query_levels)
params.explicit_lod = bld_base->uint_bld.zero;
unsigned sample_key = 0;
nir_deref_instr *texture_deref_instr = NULL;
nir_deref_instr *sampler_deref_instr = NULL;
+ LLVMValueRef texture_unit_offset = NULL;
LLVMValueRef texel[NIR_MAX_VEC_COMPONENTS];
unsigned lod_src = 0;
LLVMValueRef coord_undef = LLVMGetUndef(bld_base->base.int_vec_type);
sample_key |= LP_SAMPLER_FETCH_MS;
ms_index = cast_type(bld_base, get_src(bld_base, instr->src[i].src), nir_type_int, 32);
break;
+
+ case nir_tex_src_texture_offset:
+ texture_unit_offset = get_src(bld_base, instr->src[i].src);
+ break;
+ case nir_tex_src_sampler_offset:
+ break;
default:
assert(0);
break;
params.sample_key = sample_key;
params.offsets = offsets;
params.texture_index = base_index;
+ params.texture_index_offset = texture_unit_offset;
params.sampler_index = base_index;
params.coords = coords;
params.texel = texel;
params->context_ptr = bld->context_ptr;
params->thread_data_ptr = bld->thread_data_ptr;
+ if (params->texture_index_offset)
+ params->texture_index_offset = LLVMBuildExtractElement(bld_base->base.gallivm->builder,
+ params->texture_index_offset,
+ lp_build_const_int32(bld_base->base.gallivm, 0), "");
bld->sampler->emit_tex_sample(bld->sampler,
bld->bld_base.base.gallivm,
params);
params->int_type = bld_base->int_bld.type;
params->context_ptr = bld->context_ptr;
+ if (params->texture_unit_offset)
+ params->texture_unit_offset = LLVMBuildExtractElement(bld_base->base.gallivm->builder,
+ params->texture_unit_offset,
+ lp_build_const_int32(bld_base->base.gallivm, 0), "");
bld->sampler->emit_size_query(bld->sampler,
bld->bld_base.base.gallivm,
params);