state->swizzle_b = view->swizzle_b;
state->swizzle_a = view->swizzle_a;
- state->target = texture->target;
+ state->target = view->target;
state->pot_width = util_is_power_of_two(texture->width0);
state->pot_height = util_is_power_of_two(texture->height0);
state->pot_depth = util_is_power_of_two(texture->depth0);
struct lp_build_context *coord_bld = &bld->coord_bld;
struct lp_build_context *rho_bld = &bld->lodf_bld;
const unsigned dims = bld->dims;
- LLVMValueRef ddx_ddy[2];
+ LLVMValueRef ddx_ddy[2] = {NULL};
LLVMBuilderRef builder = bld->gallivm->builder;
LLVMTypeRef i32t = LLVMInt32TypeInContext(bld->gallivm->context);
LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
* the messy cube maps for now) when requested.
*/
- first_level = bld->dynamic_state->first_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
+ first_level = bld->dynamic_state->first_level(bld->dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec, TRUE);
float_size = lp_build_int_to_float(float_size_bld, int_size);
if (dims > 2) {
ddx_ddy[1] = lp_build_abs(coord_bld, ddx_ddy[1]);
}
+ else {
+ ddx_ddy[1] = NULL; /* silence compiler warning */
+ }
if (dims < 2) {
rho_xvec = lp_build_swizzle_aos(coord_bld, ddx_ddy[0], swizzle0);
{
LLVMBuilderRef builder = bld->gallivm->builder;
+ struct lp_sampler_dynamic_state *dynamic_state = bld->dynamic_state;
struct lp_build_context *lodf_bld = &bld->lodf_bld;
LLVMValueRef lod;
* This is hit during mipmap generation.
*/
LLVMValueRef min_lod =
- bld->dynamic_state->min_lod(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->min_lod(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
}
/* add sampler lod bias */
if (bld->static_sampler_state->lod_bias_non_zero) {
LLVMValueRef sampler_lod_bias =
- bld->dynamic_state->lod_bias(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->lod_bias(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
sampler_lod_bias = lp_build_broadcast_scalar(lodf_bld,
sampler_lod_bias);
lod = LLVMBuildFAdd(builder, lod, sampler_lod_bias, "sampler_lod_bias");
/* clamp lod */
if (bld->static_sampler_state->apply_max_lod) {
LLVMValueRef max_lod =
- bld->dynamic_state->max_lod(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->max_lod(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
max_lod = lp_build_broadcast_scalar(lodf_bld, max_lod);
lod = lp_build_min(lodf_bld, lod, max_lod);
}
if (bld->static_sampler_state->apply_min_lod) {
LLVMValueRef min_lod =
- bld->dynamic_state->min_lod(bld->dynamic_state,
- bld->gallivm, sampler_unit);
+ dynamic_state->min_lod(dynamic_state, bld->gallivm,
+ bld->context_ptr, sampler_unit);
min_lod = lp_build_broadcast_scalar(lodf_bld, min_lod);
lod = lp_build_max(lodf_bld, lod, min_lod);
LLVMValueRef *out_of_bounds)
{
struct lp_build_context *leveli_bld = &bld->leveli_bld;
+ struct lp_sampler_dynamic_state *dynamic_state = bld->dynamic_state;
LLVMValueRef first_level, last_level, level;
- first_level = bld->dynamic_state->first_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
- last_level = bld->dynamic_state->last_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
+ first_level = dynamic_state->first_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
+ last_level = dynamic_state->last_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
first_level = lp_build_broadcast_scalar(leveli_bld, first_level);
last_level = lp_build_broadcast_scalar(leveli_bld, last_level);
bld->int_coord_bld.type,
out);
}
+ level = lp_build_andnot(&bld->int_coord_bld, level, *out_of_bounds);
*level_out = level;
}
else {
LLVMValueRef *level1_out)
{
LLVMBuilderRef builder = bld->gallivm->builder;
+ struct lp_sampler_dynamic_state *dynamic_state = bld->dynamic_state;
struct lp_build_context *leveli_bld = &bld->leveli_bld;
struct lp_build_context *levelf_bld = &bld->levelf_bld;
LLVMValueRef first_level, last_level;
assert(bld->num_lods == bld->num_mips);
- first_level = bld->dynamic_state->first_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
- last_level = bld->dynamic_state->last_level(bld->dynamic_state,
- bld->gallivm, texture_unit);
+ first_level = dynamic_state->first_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
+ last_level = dynamic_state->last_level(dynamic_state, bld->gallivm,
+ bld->context_ptr, texture_unit);
first_level = lp_build_broadcast_scalar(leveli_bld, first_level);
last_level = lp_build_broadcast_scalar(leveli_bld, last_level);
* ends in the process.
*/
- /*
- * This code (vector select in particular) only works with llvm 3.1
- * (if there's more than one quad, with x86 backend). Might consider
- * converting to our lp_bld_logic helpers.
- */
-#if HAVE_LLVM < 0x0301
- assert(leveli_bld->type.length == 1);
-#endif
-
/* *level0_out < first_level */
clamp_min = LLVMBuildICmp(builder, LLVMIntSLT,
*level0_out, first_level,
bld->row_stride_array,
ilevel);
}
- if (dims == 3 ||
- bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
- bld->static_texture_state->target == PIPE_TEXTURE_1D_ARRAY ||
- bld->static_texture_state->target == PIPE_TEXTURE_2D_ARRAY) {
+ if (dims == 3 || has_layer_coord(bld->static_texture_state->target)) {
*img_stride_vec = lp_build_get_level_stride_vec(bld,
bld->img_stride_array,
ilevel);
LLVMValueRef ma, mai, signma, signmabit, imahalfpos;
LLVMValueRef posHalf = lp_build_const_vec(gallivm, coord_bld->type, 0.5);
LLVMValueRef signmask = lp_build_const_int_vec(gallivm, intctype,
- 1 << (intctype.width - 1));
+ 1LL << (intctype.width - 1));
LLVMValueRef signshift = lp_build_const_int_vec(gallivm, intctype,
intctype.width -1);
LLVMValueRef facex = lp_build_const_int_vec(gallivm, intctype, PIPE_TEX_FACE_POS_X);