From 09c31b46d39bf05e10b791dd0793091ab1366327 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 28 Sep 2020 16:11:38 +0200 Subject: [PATCH] st/mesa: use roundf instead of floorf for lod-bias rounding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: (cherry picked from commit 7685c37bf47104497d70c4580abb9e050ea8100f) --- .pick_status.json | 2 +- src/mesa/state_tracker/st_atom_sampler.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index d68fbf92e85..a1d3640953d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -220,7 +220,7 @@ "description": "st/mesa: use roundf instead of floorf for lod-bias rounding", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "132b69c4edb824c70c98f8937c63e49b04f3adff" }, diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 7ae981b71b4..3efbdc2c827 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;