summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_format.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-10-22 23:32:16 +0200
committerMarek Olšák <[email protected]>2015-10-24 00:01:20 +0200
commite1c098f2381de53bd0a3260d330b057c8bfb3156 (patch)
treef5ab1821583791291145f1e892d2b28646c21467 /src/gallium/auxiliary/util/u_format.c
parent06083046a4a6e8321cc0230f84208c8e10947105 (diff)
util/format: add helper util_format_is_snorm8
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_format.c')
-rw-r--r--src/gallium/auxiliary/util/u_format.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index c1ce408119f..79630bf6dc3 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -170,6 +170,25 @@ util_format_is_snorm(enum pipe_format format)
}
boolean
+util_format_is_snorm8(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ int i;
+
+ if (desc->is_mixed)
+ return FALSE;
+
+ i = util_format_get_first_non_void_channel(format);
+ if (i == -1)
+ return FALSE;
+
+ return desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED &&
+ !desc->channel[i].pure_integer &&
+ desc->channel[i].normalized &&
+ desc->channel[i].size == 8;
+}
+
+boolean
util_format_is_luminance_alpha(enum pipe_format format)
{
const struct util_format_description *desc =