Mesa (master): st/mesa: use roundf instead of floorf for lod-bias rounding
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Sep 29 09:23:28 UTC 2020
Module: Mesa
Branch: master
Commit: 7685c37bf47104497d70c4580abb9e050ea8100f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7685c37bf47104497d70c4580abb9e050ea8100f
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Mon Sep 28 16:11:38 2020 +0200
st/mesa: use roundf instead of floorf for lod-bias rounding
There's no good reason not to use a symmetric rounding mode here. This
fixes the following GL CTS case for me:
GTF-GL33.gtf21.GL3Tests.texture_lod_bias.texture_lod_bias_all
Fixes: 132b69c4edb ("st/mesa: round lod_bias to a multiple of 1/256")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6892>
---
src/mesa/state_tracker/st_atom_sampler.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 0c188c104c1..0d99eae6e61 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -132,7 +132,7 @@ st_convert_sampler(const struct st_context *st,
* levels.
*/
sampler->lod_bias = CLAMP(sampler->lod_bias, -16, 16);
- sampler->lod_bias = floorf(sampler->lod_bias * 256) / 256;
+ sampler->lod_bias = roundf(sampler->lod_bias * 256) / 256;
sampler->min_lod = MAX2(msamp->MinLod, 0.0f);
sampler->max_lod = msamp->MaxLod;
More information about the mesa-commit
mailing list