Mesa (main): panfrost: Add tristate_is_defined helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 20 19:00:15 UTC 2022


Module: Mesa
Branch: main
Commit: 9cdd32257fbeaa927668beec503ad130f86168e5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cdd32257fbeaa927668beec503ad130f86168e5

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Jun 15 16:03:32 2022 -0400

panfrost: Add tristate_is_defined helper

This is useful to ensure that the tri-state has been set. It could be inlined,
but the tri-state structure is designed to be opaque so this matches better.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17068>

---

 src/gallium/drivers/panfrost/pan_job.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h
index 49dedf84d8b..7ca6fe552a6 100644
--- a/src/gallium/drivers/panfrost/pan_job.h
+++ b/src/gallium/drivers/panfrost/pan_job.h
@@ -79,6 +79,16 @@ pan_tristate_get(struct pan_tristate state)
         return (state.v == PAN_TRISTATE_TRUE);
 }
 
+/*
+ * Check whether a tristate has a defined value (not PAN_TRISTATE_DONTCARE). If
+ * true, pan_tristate_get will return a defined value.
+ */
+static inline bool
+pan_tristate_is_defined(struct pan_tristate state)
+{
+        return (state.v != PAN_TRISTATE_DONTCARE);
+}
+
 /* A panfrost_batch corresponds to a bound FBO we're rendering to,
  * collecting over multiple draws. */
 



More information about the mesa-commit mailing list