Mesa (staging/20.1): radv: use util_float_to_half_rtz

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 18 23:00:42 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: e2d6c21d94a2008d51ab5798b1a5d7ff0da60089
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2d6c21d94a2008d51ab5798b1a5d7ff0da60089

Author: Christopher Egert <cme3000 at gmail.com>
Date:   Fri May 15 16:41:15 2020 +0200

radv: use util_float_to_half_rtz

Since commit 8b8af6d398a94cb07015c695fdfdb5c157aa72cf there is a
performance regression in dirt 4 on picasso APUs.

The game ends up feeding a large value into this which overflows on the
conversion to 16bit float. With the old implementation (which now lives
in util_float_to_half_rtz) it would be clamped to inf-1, while the new
one returns inf. This causes a performance hit somehow at some point
down the line.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Fixes: 8b8af6d398a "gallium/util: Switch util_float_to_half to _mesa_float_to_half()'s impl."
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5062>
(cherry picked from commit 78615dcca19699737bf9cbc784b66d9ea966bcc0)

---

 .pick_status.json             | 2 +-
 src/amd/vulkan/radv_formats.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index c408576c099..ddd6527f28e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -292,7 +292,7 @@
         "description": "radv: use util_float_to_half_rtz",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "8b8af6d398a94cb07015c695fdfdb5c157aa72cf"
     },
diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
index a790459c900..badfcc4f72f 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -1060,7 +1060,7 @@ bool radv_format_pack_clear_color(VkFormat format,
 			if (channel->size == 32) {
 				memcpy(&v, &value->float32[c], 4);
 			} else if(channel->size == 16) {
-				v = util_float_to_half(value->float32[c]);
+				v = util_float_to_half_rtz(value->float32[c]);
 			} else {
 				fprintf(stderr, "failed to fast clear for unhandled float size in format %d\n", format);
 				return false;



More information about the mesa-commit mailing list