aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_format.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-26 17:08:48 +0200
committermarha <marha@users.sourceforge.net>2011-09-26 17:08:48 +0200
commit95acf9816e008fa46a6c2fa2f35500deb358bb69 (patch)
treead86feed38d780515cf9da608c5ea21eed04e17d /mesalib/src/gallium/auxiliary/util/u_format.h
parent4f67039e9191d5251c39069bd791a05c5cf22022 (diff)
parent873965b49f283ad028dd4e0e5b7e93a758c84993 (diff)
downloadvcxsrv-95acf9816e008fa46a6c2fa2f35500deb358bb69.tar.gz
vcxsrv-95acf9816e008fa46a6c2fa2f35500deb358bb69.tar.bz2
vcxsrv-95acf9816e008fa46a6c2fa2f35500deb358bb69.zip
Merge remote-tracking branch 'origin/released'
Conflicts: libXmu/src/CmapAlloc.c
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_format.h')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index 2eb3e1b80..98528ea59 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -411,6 +411,27 @@ util_format_is_s3tc(enum pipe_format format)
}
static INLINE boolean
+util_format_is_srgb(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ return desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB;
+}
+
+static INLINE boolean
+util_format_has_depth(const struct util_format_description *desc)
+{
+ return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
+ desc->swizzle[0] != UTIL_FORMAT_SWIZZLE_NONE;
+}
+
+static INLINE boolean
+util_format_has_stencil(const struct util_format_description *desc)
+{
+ return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
+ desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE;
+}
+
+static INLINE boolean
util_format_is_depth_or_stencil(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
@@ -420,10 +441,11 @@ util_format_is_depth_or_stencil(enum pipe_format format)
return FALSE;
}
- return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ? TRUE : FALSE;
+ return util_format_has_depth(desc) ||
+ util_format_has_stencil(desc);
}
-static INLINE boolean
+static INLINE boolean
util_format_is_depth_and_stencil(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
@@ -433,12 +455,8 @@ util_format_is_depth_and_stencil(enum pipe_format format)
return FALSE;
}
- if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) {
- return FALSE;
- }
-
- return (desc->swizzle[0] != UTIL_FORMAT_SWIZZLE_NONE &&
- desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE) ? TRUE : FALSE;
+ return util_format_has_depth(desc) &&
+ util_format_has_stencil(desc);
}