Mesa (main): gallivm: remove code to force nearest s/t interpolation
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Aug 9 07:24:39 UTC 2021
Module: Mesa
Branch: main
Commit: 2f06642b06c94f07f4bfe3df32b25659428c9144
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f06642b06c94f07f4bfe3df32b25659428c9144
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Fri Aug 6 15:09:40 2021 +0200
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 at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12240>
---
src/gallium/auxiliary/gallivm/lp_bld_sample.h | 4 -
src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 104 +++++++++-------------
2 files changed, 43 insertions(+), 65 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 580daa89dc8..604b3b04a0e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -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;
};
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
index 5d501b6ac4b..0564b156d97 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
@@ -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) {
More information about the mesa-commit
mailing list