mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 13:40:11 +01:00
util/u_format: add _is_alpha()
Because of render-to-alpha (000x) shenanigans, freedreno needs to do some special handling when rendering to alpha-only formats. And I noticed that while we had _is_luminance(), _is_intensity(), etc, an _is_alpha() helper was missing. So fix that. Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
parent
480fe244dd
commit
3e0a82b52e
2 changed files with 19 additions and 0 deletions
|
|
@ -91,6 +91,23 @@ util_format_is_luminance(enum pipe_format format)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
boolean
|
||||
util_format_is_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[0] == UTIL_FORMAT_SWIZZLE_0 &&
|
||||
desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0 &&
|
||||
desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0 &&
|
||||
desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
boolean
|
||||
util_format_is_pure_integer(enum pipe_format format)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -661,6 +661,8 @@ util_format_has_alpha(enum pipe_format format);
|
|||
boolean
|
||||
util_format_is_luminance(enum pipe_format format);
|
||||
|
||||
boolean
|
||||
util_format_is_alpha(enum pipe_format format);
|
||||
|
||||
boolean
|
||||
util_format_is_luminance_alpha(enum pipe_format format);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue