Mesa (main): radeonsi: improve rounding of zmin

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 17 01:24:03 UTC 2021


Module: Mesa
Branch: main
Commit: e6d996f8ff2e365b96de3e521275764ada317249
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6d996f8ff2e365b96de3e521275764ada317249

Author: Filip Gawin <filip.gawin at zoho.com>
Date:   Mon Aug 16 13:13:43 2021 +0200

radeonsi: improve rounding of zmin

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12389>

---

 src/gallium/drivers/radeonsi/si_clear.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c
index 7f236fe01a5..48283c0340e 100644
--- a/src/gallium/drivers/radeonsi/si_clear.c
+++ b/src/gallium/drivers/radeonsi/si_clear.c
@@ -476,7 +476,7 @@ static uint32_t si_get_htile_clear_value(struct si_texture *tex, float depth)
    const uint32_t smem  = 0;
 
    /* Convert depthValue to 14-bit zmin/zmax uint values. */
-   const uint32_t zmin = (depth * max_z_value) + 0.5f;
+   const uint32_t zmin = lroundf(depth * max_z_value);
    const uint32_t zmax = zmin;
 
    if (tex->htile_stencil_disabled) {



More information about the mesa-commit mailing list