summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw/draw_llvm_sample.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2015-03-28 20:51:23 +0100
committerRoland Scheidegger <sroland@vmware.com>2015-03-31 17:23:51 +0200
commit1863ed21ffbb3ab7fd9875dc25e32ececea79d50 (patch)
treea121276df53929126c0a7065fb068710b87a168d /src/gallium/auxiliary/draw/draw_llvm_sample.c
parent0fc5b80e7abae061dd5b0a17a0e775619a5245be (diff)
downloadexternal_mesa3d-1863ed21ffbb3ab7fd9875dc25e32ececea79d50.zip
external_mesa3d-1863ed21ffbb3ab7fd9875dc25e32ececea79d50.tar.gz
external_mesa3d-1863ed21ffbb3ab7fd9875dc25e32ececea79d50.tar.bz2
gallivm: simplify sampler interface
This has got a bit out of control with more and more parameters added. Worse, whenever something in there changes all callees have to be updated for that, even though they don't really do much with any parameter in there except pass it on to the actual sampling function. Hence simply put almost everything into a struct. Also instead of relying on some arguments being NULL, be explicit and set this in a key (which is just reused for function generation for simplicity). (The code still relies on them being NULL in the end for now.) Technically there is a minimal functional change here for shadow sampling: if shadow sampling is done is now determined explicitly by the texture function (either sample_c or the gl-style tex func inherit this from target) instead of the static texture state. These two should always match, however. Otherwise, it should generate all the same code. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_llvm_sample.c')
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm_sample.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c
index 16d075c..32cad59 100644
--- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
+++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c
@@ -229,38 +229,19 @@ draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
static void
draw_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 draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
+ unsigned texture_index = params->texture_index;
+ unsigned sampler_index = params->sampler_index;
assert(texture_index < PIPE_MAX_SHADER_SAMPLER_VIEWS);
assert(sampler_index < PIPE_MAX_SAMPLERS);
- 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);
}
@@ -306,7 +287,7 @@ draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_stat
return NULL;
sampler->base.destroy = draw_llvm_sampler_soa_destroy;
- sampler->base.emit_fetch_texel = draw_llvm_sampler_soa_emit_fetch_texel;
+ sampler->base.emit_tex_sample = draw_llvm_sampler_soa_emit_fetch_texel;
sampler->base.emit_size_query = draw_llvm_sampler_soa_emit_size_query;
sampler->dynamic_state.base.width = draw_llvm_texture_width;
sampler->dynamic_state.base.height = draw_llvm_texture_height;