From: Dave Airlie Date: Tue, 19 May 2020 02:01:54 +0000 (+1000) Subject: gallivm/sample: change texture function generator api X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b15a08ebdefd9aff8cd0f8b727052515f61a4a0;p=mesa.git gallivm/sample: change texture function generator api This passes some more paramters in directly and changes how the returns are done in order to reuse this function for indirect texture support later. Reviewed-by: Roland Scheidegger Part-of: --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 2565c9b1420..86c70bc3088 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -3583,7 +3583,9 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm, const struct lp_static_texture_state *static_texture_state, const struct lp_static_sampler_state *static_sampler_state, struct lp_sampler_dynamic_state *dynamic_state, - const struct lp_sampler_params *params) + const struct lp_sampler_params *params, + int texture_index, int sampler_index, + LLVMValueRef *tex_ret) { LLVMBuilderRef builder = gallivm->builder; LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent( @@ -3591,12 +3593,9 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm, LLVMValueRef function, inst; LLVMValueRef args[LP_MAX_TEX_FUNC_ARGS]; LLVMBasicBlockRef bb; - LLVMValueRef tex_ret; unsigned num_args = 0; char func_name[64]; unsigned i, num_coords, num_derivs, num_offsets, layer; - unsigned texture_index = params->texture_index; - unsigned sampler_index = params->sampler_index; unsigned sample_key = params->sample_key; const LLVMValueRef *coords = params->coords; const LLVMValueRef *offsets = params->offsets; @@ -3741,14 +3740,11 @@ lp_build_sample_soa_func(struct gallivm_state *gallivm, assert(num_args <= LP_MAX_TEX_FUNC_ARGS); - tex_ret = LLVMBuildCall(builder, function, args, num_args, ""); + *tex_ret = LLVMBuildCall(builder, function, args, num_args, ""); bb = LLVMGetInsertBlock(builder); inst = LLVMGetLastInstruction(bb); LLVMSetInstructionCallConv(inst, LLVMFastCallConv); - for (i = 0; i < 4; i++) { - params->texel[i] = LLVMBuildExtractValue(gallivm->builder, tex_ret, i, ""); - } } @@ -3802,11 +3798,16 @@ lp_build_sample_soa(const struct lp_static_texture_state *static_texture_state, } if (use_tex_func) { + LLVMValueRef tex_ret; lp_build_sample_soa_func(gallivm, static_texture_state, static_sampler_state, dynamic_state, - params); + params, params->texture_index, params->sampler_index, &tex_ret); + + for (unsigned i = 0; i < 4; i++) { + params->texel[i] = LLVMBuildExtractValue(gallivm->builder, tex_ret, i, ""); + } } else { lp_build_sample_soa_code(gallivm,