gallivm: remove code to force nearest s/t interpolation

These two bits were added in 2012, but never got wired up. Let's cut our
losses, and remove them again. 9 years unused seems sufficient.

While we're at it, remove reduction_mode from the hacks-section, because
this isn't a hack at all, rather normal state.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12240>
This commit is contained in:
Erik Faye-Lund 2021-08-06 15:09:40 +02:00 committed by Marge Bot
parent 7d3ab96f39
commit 2f06642b06
2 changed files with 43 additions and 65 deletions

View file

@ -203,10 +203,6 @@ struct lp_static_sampler_state
unsigned apply_max_lod:1; /**< max_lod < last_level ? */
unsigned seamless_cube_map:1;
unsigned aniso:1;
/* Hacks */
unsigned force_nearest_s:1;
unsigned force_nearest_t:1;
unsigned reduction_mode:2;
};

View file

@ -686,63 +686,46 @@ lp_build_sample_fetch_image_linear(struct lp_build_sample_context *bld,
/*
* 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;
@ -827,10 +810,9 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
/* 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) {