panfrost: Fix UNORM 16 rendering
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 19 Feb 2021 18:38:57 +0000 (13:38 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 22 Feb 2021 19:17:49 +0000 (19:17 +0000)
fp16 loses precision.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>

src/panfrost/util/pan_lower_framebuffer.c

index df9929b..0a4b82b 100644 (file)
@@ -66,11 +66,12 @@ pan_unpacked_type_for_format(const struct util_format_description *desc)
                 unreachable("Void format not renderable");
 
         bool large = (desc->channel[c].size > 16);
+        bool large_norm = (desc->channel[c].size > 8);
         bool bit8 = (desc->channel[c].size == 8);
         assert(desc->channel[c].size <= 32);
 
         if (desc->channel[c].normalized)
-                return large ? nir_type_float32 : nir_type_float16;
+                return large_norm ? nir_type_float32 : nir_type_float16;
 
         switch (desc->channel[c].type) {
         case UTIL_FORMAT_TYPE_UNSIGNED: