radv: improve rounding of zmin
authorFilip Gawin <filip.gawin@zoho.com>
Mon, 16 Aug 2021 11:02:50 +0000 (13:02 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 17 Aug 2021 11:03:59 +0000 (11:03 +0000)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12388>

src/amd/vulkan/radv_meta_clear.c

index 82bb12b..e41ac7b 100644 (file)
@@ -888,7 +888,7 @@ radv_get_htile_fast_clear_value(const struct radv_device *device, const struct r
    uint32_t zmin, zmax;
 
    /* Convert the depth value to 14-bit zmin/zmax values. */
-   zmin = ((value.depth * max_zval) + 0.5f);
+   zmin = lroundf(value.depth * max_zval);
    zmax = zmin;
 
    if (radv_image_tile_stencil_disabled(device, image)) {