/*
* Linear interpolation with 8.8 fixed point.
*/
- if (bld->static_sampler_state->force_nearest_s) {
- /* special case 1-D lerp */
- packed = lp_build_lerp(&u8n,
- t_fpart,
- neighbors[0][0][0],
- neighbors[0][0][1],
- LP_BLD_LERP_PRESCALED_WEIGHTS);
- }
- else if (bld->static_sampler_state->force_nearest_t) {
- /* special case 1-D lerp */
- packed = lp_build_lerp(&u8n,
- s_fpart,
- neighbors[0][0][0],
- neighbors[0][0][1],
- LP_BLD_LERP_PRESCALED_WEIGHTS);
- }
- else {
- /* general 1/2/3-D lerping */
- if (dims == 1) {
- lp_build_reduce_filter(&u8n,
- bld->static_sampler_state->reduction_mode,
- LP_BLD_LERP_PRESCALED_WEIGHTS,
- 1,
- s_fpart,
- &neighbors[0][0][0],
- &neighbors[0][0][1],
- &packed);
- } else if (dims == 2) {
- /* 2-D lerp */
- lp_build_reduce_filter_2d(&u8n,
- bld->static_sampler_state->reduction_mode,
- LP_BLD_LERP_PRESCALED_WEIGHTS,
- 1,
- s_fpart, t_fpart,
- &neighbors[0][0][0],
- &neighbors[0][0][1],
- &neighbors[0][1][0],
- &neighbors[0][1][1],
- &packed);
- } else {
- /* 3-D lerp */
- assert(dims == 3);
- lp_build_reduce_filter_3d(&u8n,
- bld->static_sampler_state->reduction_mode,
- LP_BLD_LERP_PRESCALED_WEIGHTS,
- 1,
- s_fpart, t_fpart, r_fpart,
- &neighbors[0][0][0],
- &neighbors[0][0][1],
- &neighbors[0][1][0],
- &neighbors[0][1][1],
- &neighbors[1][0][0],
- &neighbors[1][0][1],
- &neighbors[1][1][0],
- &neighbors[1][1][1],
- &packed);
- }
+
+ /* general 1/2/3-D lerping */
+ if (dims == 1) {
+ lp_build_reduce_filter(&u8n,
+ bld->static_sampler_state->reduction_mode,
+ LP_BLD_LERP_PRESCALED_WEIGHTS,
+ 1,
+ s_fpart,
+ &neighbors[0][0][0],
+ &neighbors[0][0][1],
+ &packed);
+ } else if (dims == 2) {
+ /* 2-D lerp */
+ lp_build_reduce_filter_2d(&u8n,
+ bld->static_sampler_state->reduction_mode,
+ LP_BLD_LERP_PRESCALED_WEIGHTS,
+ 1,
+ s_fpart, t_fpart,
+ &neighbors[0][0][0],
+ &neighbors[0][0][1],
+ &neighbors[0][1][0],
+ &neighbors[0][1][1],
+ &packed);
+ } else {
+ /* 3-D lerp */
+ assert(dims == 3);
+ lp_build_reduce_filter_3d(&u8n,
+ bld->static_sampler_state->reduction_mode,
+ LP_BLD_LERP_PRESCALED_WEIGHTS,
+ 1,
+ s_fpart, t_fpart, r_fpart,
+ &neighbors[0][0][0],
+ &neighbors[0][0][1],
+ &neighbors[0][1][0],
+ &neighbors[0][1][1],
+ &neighbors[1][0][0],
+ &neighbors[1][0][1],
+ &neighbors[1][1][0],
+ &neighbors[1][1][1],
+ &packed);
}
*colors = packed;
/* subtract 0.5 (add -128) */
i32_c128 = lp_build_const_int_vec(bld->gallivm, i32.type, -128);
- if (!bld->static_sampler_state->force_nearest_s) {
- s = LLVMBuildAdd(builder, s, i32_c128, "");
- }
- if (dims >= 2 && !bld->static_sampler_state->force_nearest_t) {
+
+ s = LLVMBuildAdd(builder, s, i32_c128, "");
+ if (dims >= 2) {
t = LLVMBuildAdd(builder, t, i32_c128, "");
}
if (dims >= 3) {