[Mesa-dev] 2 util_format patches

Marek Olšák maraeo at gmail.com
Mon May 3 10:25:58 PDT 2010


José,

the first patch removes the PIPE_FORMAT_ prefix in a string returned by
util_format_name, it makes debug logs shorter. The second patch adds
util_format_is_plain.

diff --git a/src/gallium/auxiliary/util/u_format.h
b/src/gallium/auxiliary/util/u_format.h
index fb6ade5..d851c31 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -332,10 +332,10 @@ util_format_name(enum pipe_format format)

    assert(desc);
    if (!desc) {
-      return "PIPE_FORMAT_???";
+      return "???";
    }

-   return desc->name;
+   return desc->name+12;
 }

 static INLINE boolean

diff --git a/src/gallium/auxiliary/util/u_format.h
b/src/gallium/auxiliary/util/u_format.h
index d851c31..350b817 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -338,6 +338,18 @@ util_format_name(enum pipe_format format)
    return desc->name+12;
 }

+static INLINE boolean
+util_format_is_plain(enum pipe_format format)
+{
+   const struct util_format_description *desc =
util_format_description(format);
+
+   if (!format) {
+      return FALSE;
+   }
+
+   return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ? TRUE : FALSE;
+}
+
 static INLINE boolean
 util_format_is_s3tc(enum pipe_format format)
 {

May I push them?

-Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100503/ad43c2e4/attachment.html>


More information about the mesa-dev mailing list