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 *
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.
*
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,
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;
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) {
/*
* 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;
}
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);
* 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;
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);
}
}
* 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));
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);
}
}
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);
};
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;
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
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);
}
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);
}