diff options
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm_sample.c | 22 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.h | 21 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 34 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 9 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_tex_sample.c | 22 | ||||
-rw-r--r-- | src/gallium/drivers/swr/swr_tex_sample.cpp | 22 |
7 files changed, 51 insertions, 97 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index cb316956162..1845c0560a9 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -251,30 +251,16 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, static void draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct gallivm_state *gallivm, - struct lp_type type, - unsigned texture_unit, - unsigned target, - LLVMValueRef context_ptr, - boolean is_sviewinfo, - enum lp_sampler_lod_property lod_property, - LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef *sizes_out) + const struct lp_sampler_size_query_params *params) { struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base; - assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); + assert(params->texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); lp_build_size_query_soa(gallivm, - &sampler->dynamic_state.static_state[texture_unit].texture_state, + &sampler->dynamic_state.static_state[params->texture_unit].texture_state, &sampler->dynamic_state.base, - type, - texture_unit, - target, - context_ptr, - is_sviewinfo, - lod_property, - explicit_lod, - sizes_out); + params); } struct lp_build_sampler_soa * diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 902ae41f960..9ec051a340b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -110,7 +110,17 @@ struct lp_sampler_params LLVMValueRef *texel; }; - +struct lp_sampler_size_query_params +{ + struct lp_type int_type; + unsigned texture_unit; + unsigned target; + LLVMValueRef context_ptr; + boolean is_sviewinfo; + enum lp_sampler_lod_property lod_property; + LLVMValueRef explicit_lod; + LLVMValueRef *sizes_out; +}; /** * Texture static state. * @@ -606,14 +616,7 @@ void lp_build_size_query_soa(struct gallivm_state *gallivm, const struct lp_static_texture_state *static_state, struct lp_sampler_dynamic_state *dynamic_state, - struct lp_type int_type, - unsigned texture_unit, - unsigned target, - LLVMValueRef context_ptr, - boolean is_sviewinfo, - enum lp_sampler_lod_property lod_property, - LLVMValueRef explicit_lod, - LLVMValueRef *sizes_out); + const struct lp_sampler_size_query_params *params); void lp_build_sample_nop(struct gallivm_state *gallivm, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 937948bbb02..83db0edc82f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -3439,14 +3439,7 @@ void lp_build_size_query_soa(struct gallivm_state *gallivm, const struct lp_static_texture_state *static_state, struct lp_sampler_dynamic_state *dynamic_state, - struct lp_type int_type, - unsigned texture_unit, - unsigned target, - LLVMValueRef context_ptr, - boolean is_sviewinfo, - enum lp_sampler_lod_property lod_property, - LLVMValueRef explicit_lod, - LLVMValueRef *sizes_out) + const struct lp_sampler_size_query_params *params) { LLVMValueRef lod, level, size; LLVMValueRef first_level = NULL; @@ -3454,6 +3447,9 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, boolean has_array; unsigned num_lods = 1; struct lp_build_context bld_int_vec4; + LLVMValueRef context_ptr = params->context_ptr; + unsigned texture_unit = params->texture_unit; + unsigned target = params->target; if (static_state->format == PIPE_FORMAT_NONE) { /* @@ -3461,9 +3457,9 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, * all zero as mandated by d3d10 in this case. */ unsigned chan; - LLVMValueRef zero = lp_build_const_vec(gallivm, int_type, 0.0F); + LLVMValueRef zero = lp_build_const_vec(gallivm, params->int_type, 0.0F); for (chan = 0; chan < 4; chan++) { - sizes_out[chan] = zero; + params->sizes_out[chan] = zero; } return; } @@ -3508,13 +3504,13 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, break; } - assert(!int_type.floating); + assert(!params->int_type.floating); lp_build_context_init(&bld_int_vec4, gallivm, lp_type_int_vec(32, 128)); - if (explicit_lod) { + if (params->explicit_lod) { /* FIXME: this needs to honor per-element lod */ - lod = LLVMBuildExtractElement(gallivm->builder, explicit_lod, + lod = LLVMBuildExtractElement(gallivm->builder, params->explicit_lod, lp_build_const_int32(gallivm, 0), ""); first_level = dynamic_state->first_level(dynamic_state, gallivm, context_ptr, texture_unit); @@ -3568,7 +3564,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, * if level is out of bounds (note this can't cover unbound texture * here, which also requires returning zero). */ - if (explicit_lod && is_sviewinfo) { + if (params->explicit_lod && params->is_sviewinfo) { LLVMValueRef last_level, out, out1; struct lp_build_context leveli_bld; @@ -3590,13 +3586,13 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, size = lp_build_andnot(&bld_int_vec4, size, out); } for (i = 0; i < dims + (has_array ? 1 : 0); i++) { - sizes_out[i] = lp_build_extract_broadcast(gallivm, bld_int_vec4.type, int_type, + params->sizes_out[i] = lp_build_extract_broadcast(gallivm, bld_int_vec4.type, params->int_type, size, lp_build_const_int32(gallivm, i)); } - if (is_sviewinfo) { + if (params->is_sviewinfo) { for (; i < 4; i++) { - sizes_out[i] = lp_build_const_vec(gallivm, int_type, 0.0); + params->sizes_out[i] = lp_build_const_vec(gallivm, params->int_type, 0.0); } } @@ -3604,7 +3600,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, * if there's no explicit_lod (buffers, rects) queries requiring nr of * mips would be illegal. */ - if (is_sviewinfo && explicit_lod) { + if (params->is_sviewinfo && params->explicit_lod) { struct lp_build_context bld_int_scalar; LLVMValueRef num_levels; lp_build_context_init(&bld_int_scalar, gallivm, lp_type_int(32)); @@ -3620,7 +3616,7 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, num_levels = lp_build_sub(&bld_int_scalar, last_level, first_level); num_levels = lp_build_add(&bld_int_scalar, num_levels, bld_int_scalar.one); } - sizes_out[3] = lp_build_broadcast(gallivm, lp_build_vec_type(gallivm, int_type), + params->sizes_out[3] = lp_build_broadcast(gallivm, lp_build_vec_type(gallivm, params->int_type), num_levels); } } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h index b005d7a0ac1..b9094dcf597 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h @@ -194,14 +194,7 @@ struct lp_build_sampler_soa void (*emit_size_query)( const struct lp_build_sampler_soa *sampler, struct gallivm_state *gallivm, - struct lp_type type, - unsigned unit, - unsigned target, - LLVMValueRef context_ptr, - boolean need_nr_mips, - enum lp_sampler_lod_property, - LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef *sizes_out); + const struct lp_sampler_size_query_params *params); }; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index a19be8a503a..13fd877083a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -2664,6 +2664,7 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld, unsigned i; unsigned unit = inst->Src[1].Register.Index; unsigned target, pipe_target; + struct lp_sampler_size_query_params params; if (is_sviewinfo) { target = bld->sv[unit].Resource; @@ -2701,15 +2702,18 @@ emit_size_query( struct lp_build_tgsi_soa_context *bld, pipe_target = tgsi_to_pipe_tex_target(target); + params.int_type = bld->bld_base.int_bld.type; + params.texture_unit = unit; + params.target = pipe_target; + params.context_ptr = bld->context_ptr; + params.is_sviewinfo = TRUE; + params.lod_property = lod_property; + params.explicit_lod = explicit_lod; + params.sizes_out = sizes_out; + bld->sampler->emit_size_query(bld->sampler, bld->bld_base.base.gallivm, - bld->bld_base.int_bld.type, - unit, pipe_target, - bld->context_ptr, - TRUE, - lod_property, - explicit_lod, - sizes_out); + ¶ms); } static boolean diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 5762b7b4833..8adaa8e77d9 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -276,30 +276,16 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, static void lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct gallivm_state *gallivm, - struct lp_type type, - unsigned texture_unit, - unsigned target, - LLVMValueRef context_ptr, - boolean is_sviewinfo, - enum lp_sampler_lod_property lod_property, - LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef *sizes_out) + const struct lp_sampler_size_query_params *params) { struct lp_llvm_sampler_soa *sampler = (struct lp_llvm_sampler_soa *)base; - assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); + assert(params->texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); lp_build_size_query_soa(gallivm, - &sampler->dynamic_state.static_state[texture_unit].texture_state, + &sampler->dynamic_state.static_state[params->texture_unit].texture_state, &sampler->dynamic_state.base, - type, - texture_unit, - target, - context_ptr, - is_sviewinfo, - lod_property, - explicit_lod, - sizes_out); + params); } diff --git a/src/gallium/drivers/swr/swr_tex_sample.cpp b/src/gallium/drivers/swr/swr_tex_sample.cpp index 8172c820f22..66d6b0fdea5 100644 --- a/src/gallium/drivers/swr/swr_tex_sample.cpp +++ b/src/gallium/drivers/swr/swr_tex_sample.cpp @@ -302,31 +302,17 @@ swr_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base, static void swr_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base, struct gallivm_state *gallivm, - struct lp_type type, - unsigned texture_unit, - unsigned target, - LLVMValueRef context_ptr, - boolean is_sviewinfo, - enum lp_sampler_lod_property lod_property, - LLVMValueRef explicit_lod, /* optional */ - LLVMValueRef *sizes_out) + const struct lp_sampler_size_query_params *params) { struct swr_sampler_soa *sampler = (struct swr_sampler_soa *)base; - assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); + assert(params->texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS); lp_build_size_query_soa( gallivm, - &sampler->dynamic_state.static_state[texture_unit].texture_state, + &sampler->dynamic_state.static_state[params->texture_unit].texture_state, &sampler->dynamic_state.base, - type, - texture_unit, - target, - context_ptr, - is_sviewinfo, - lod_property, - explicit_lod, - sizes_out); + params); } |