mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
util: Add util_format_is_red
This commit is contained in:
parent
f8f0d6ce0d
commit
212b9dcd38
2 changed files with 20 additions and 0 deletions
|
|
@ -302,6 +302,23 @@ util_format_is_luminance_alpha(enum pipe_format format)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
util_format_is_red(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] == PIPE_SWIZZLE_X &&
|
||||
desc->swizzle[1] == PIPE_SWIZZLE_0 &&
|
||||
desc->swizzle[2] == PIPE_SWIZZLE_0 &&
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
util_format_is_red_alpha(enum pipe_format format)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -805,6 +805,9 @@ util_format_is_alpha(enum pipe_format format) ATTRIBUTE_CONST;
|
|||
bool
|
||||
util_format_is_luminance_alpha(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
bool
|
||||
util_format_is_red(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
bool
|
||||
util_format_is_red_alpha(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue