X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fllvmpipe%2Flp_tex_sample.c;h=5762b7b483344c4cf67948aaea6d151e052482ae;hb=237f2f2d8b45d9d956102eec6f9be63193e5269b;hp=1828069bf1a7916cb0edbd4108b51c28f6a5205a;hpb=8dad9455ff748c543635b24908566c3b94cb93a9;p=mesa.git diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 1828069bf1a..5762b7b4833 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -221,6 +221,21 @@ LP_LLVM_SAMPLER_MEMBER(lod_bias, LP_JIT_SAMPLER_LOD_BIAS, TRUE) LP_LLVM_SAMPLER_MEMBER(border_color, LP_JIT_SAMPLER_BORDER_COLOR, FALSE) +#if LP_USE_TEXTURE_CACHE +static LLVMValueRef +lp_llvm_texture_cache_ptr(const struct lp_sampler_dynamic_state *base, + struct gallivm_state *gallivm, + LLVMValueRef thread_data_ptr, + unsigned unit) +{ + /* We use the same cache for all units */ + (void)unit; + + return lp_jit_thread_data_cache(gallivm, thread_data_ptr); +} +#endif + + static void lp_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler) { @@ -235,43 +250,24 @@ lp_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler) static void lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, struct gallivm_state *gallivm, - struct lp_type type, - boolean is_fetch, - unsigned texture_index, - unsigned sampler_index, - LLVMValueRef context_ptr, - const LLVMValueRef *coords, - const LLVMValueRef *offsets, - const struct lp_derivatives *derivs, - LLVMValueRef lod_bias, /* optional */ - LLVMValueRef explicit_lod, /* optional */ - enum lp_sampler_lod_property lod_property, - LLVMValueRef *texel) + const struct lp_sampler_params *params) { struct lp_llvm_sampler_soa *sampler = (struct lp_llvm_sampler_soa *)base; + unsigned texture_index = params->texture_index; + unsigned sampler_index = params->sampler_index; assert(sampler_index < PIPE_MAX_SAMPLERS); assert(texture_index < PIPE_MAX_SHADER_SAMPLER_VIEWS); if (LP_PERF & PERF_NO_TEX) { - lp_build_sample_nop(gallivm, type, coords, texel); + lp_build_sample_nop(gallivm, params->type, params->coords, params->texel); return; } - lp_build_sample_soa(gallivm, - &sampler->dynamic_state.static_state[texture_index].texture_state, + lp_build_sample_soa(&sampler->dynamic_state.static_state[texture_index].texture_state, &sampler->dynamic_state.static_state[sampler_index].sampler_state, &sampler->dynamic_state.base, - type, - is_fetch, - texture_index, - sampler_index, - context_ptr, - coords, - offsets, - derivs, - lod_bias, explicit_lod, lod_property, - texel); + gallivm, params); } /** @@ -313,11 +309,11 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state) struct lp_llvm_sampler_soa *sampler; sampler = CALLOC_STRUCT(lp_llvm_sampler_soa); - if(!sampler) + if (!sampler) return NULL; sampler->base.destroy = lp_llvm_sampler_soa_destroy; - sampler->base.emit_fetch_texel = lp_llvm_sampler_soa_emit_fetch_texel; + sampler->base.emit_tex_sample = lp_llvm_sampler_soa_emit_fetch_texel; sampler->base.emit_size_query = lp_llvm_sampler_soa_emit_size_query; sampler->dynamic_state.base.width = lp_llvm_texture_width; sampler->dynamic_state.base.height = lp_llvm_texture_height; @@ -333,6 +329,10 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state) sampler->dynamic_state.base.lod_bias = lp_llvm_sampler_lod_bias; sampler->dynamic_state.base.border_color = lp_llvm_sampler_border_color; +#if LP_USE_TEXTURE_CACHE + sampler->dynamic_state.base.cache_ptr = lp_llvm_texture_cache_ptr; +#endif + sampler->dynamic_state.static_state = static_state; return &sampler->base;