radeonsi: improve rounding of zmin
authorFilip Gawin <filip.gawin@zoho.com>
Mon, 16 Aug 2021 11:13:43 +0000 (13:13 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 17 Aug 2021 01:09:51 +0000 (01:09 +0000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12389>

src/gallium/drivers/radeonsi/si_clear.c

index 7f236fe..48283c0 100644 (file)
@@ -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) {