Mesa (master): panfrost: Default to util_pack_color for clears

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 29 01:48:38 UTC 2019


Module: Mesa
Branch: master
Commit: 7692ad19fb617b1d37486d50da3be4bf9c3b722d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7692ad19fb617b1d37486d50da3be4bf9c3b722d

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Fri Jun 28 18:46:43 2019 -0700

panfrost: Default to util_pack_color for clears

This might help as we bringup more render-target formats.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_job.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 22f0f492b5d..2f7fe9e3cc3 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -27,6 +27,7 @@
 #include "util/hash_table.h"
 #include "util/ralloc.h"
 #include "util/u_format.h"
+#include "util/u_pack_color.h"
 
 struct panfrost_job *
 panfrost_create_job(struct panfrost_context *ctx)
@@ -210,8 +211,12 @@ pan_pack_color(const union pipe_color_union *color, enum pipe_format format)
                 /* Then we pack into a sparse u32. TODO: Why these shifts? */
                 return (b5 << 25) | (g6 << 14) | (r5 << 5);
         } else {
-                /* Unknown format */
-                assert(0);
+                /* Try Gallium's generic default path. Doesn't work for all
+                 * formats but it's a good guess. */
+
+                union util_color out;
+                util_pack_color(color->f, format, &out);
+                return out.ui[0];
         }
 
         return 0;




More information about the mesa-commit mailing list