It only checks if alpha is present, so it's the same as util_format_has_alpha.
Reviewed-by: Brian Paul <brianp@vmware.com>
/** Test if the format contains RGB, but not alpha */
boolean
-util_format_is_rgb_no_alpha(enum pipe_format format)
+util_format_has_alpha(enum pipe_format format)
{
const struct util_format_description *desc =
util_format_description(format);
- if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
- desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) {
- return TRUE;
- }
- return FALSE;
+ return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+ desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+ desc->swizzle[3] != UTIL_FORMAT_SWIZZLE_1;
}
boolean
-util_format_is_rgb_no_alpha(enum pipe_format format);
+util_format_has_alpha(enum pipe_format format);
boolean
}
}
-static INLINE boolean
-util_format_has_alpha(enum pipe_format format)
-{
- const struct util_format_description *desc = util_format_description(format);
-
- assert(format);
- if (!format) {
- return FALSE;
- }
-
- switch (desc->colorspace) {
- case UTIL_FORMAT_COLORSPACE_RGB:
- case UTIL_FORMAT_COLORSPACE_SRGB:
- return desc->swizzle[3] != UTIL_FORMAT_SWIZZLE_1;
- case UTIL_FORMAT_COLORSPACE_YUV:
- return FALSE;
- case UTIL_FORMAT_COLORSPACE_ZS:
- return FALSE;
- default:
- assert(0);
- return FALSE;
- }
-}
-
/**
* Given a linear RGB colorspace format, return the corresponding SRGB
* format, or PIPE_FORMAT_NONE if none.
bqs->base_format[i] = LUMINANCE;
else if (util_format_is_luminance_alpha(format))
bqs->base_format[i] = LUMINANCE_ALPHA;
- else if (util_format_is_rgb_no_alpha(format))
+ else if (!util_format_has_alpha(format))
bqs->base_format[i] = RGB;
else
bqs->base_format[i] = RGBA;