util: Replace usage of boolean with c11 bool in src/util/format/* and src/util/tests/format/*
This is done by find and replace: boolean -> bool TRUE -> true FALSE -> false Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: David Heidelberg <david.heidelberg@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19649>
This commit is contained in:
+73
-73
@@ -94,7 +94,7 @@ util_copy_rect(ubyte * dst,
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_float(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
@@ -102,15 +102,15 @@ util_format_is_float(enum pipe_format format)
|
||||
|
||||
i = util_format_get_first_non_void_channel(format);
|
||||
if (i < 0) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? TRUE : FALSE;
|
||||
return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? true : false;
|
||||
}
|
||||
|
||||
|
||||
/** Test if the format contains RGB, but not alpha */
|
||||
boolean
|
||||
bool
|
||||
util_format_has_alpha(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
@@ -122,7 +122,7 @@ util_format_has_alpha(enum pipe_format format)
|
||||
}
|
||||
|
||||
/** Test if format has alpha as 1 (like RGBX) */
|
||||
boolean
|
||||
bool
|
||||
util_format_has_alpha1(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
@@ -134,7 +134,7 @@ util_format_has_alpha1(enum pipe_format format)
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_1;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_luminance(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
@@ -146,12 +146,12 @@ util_format_is_luminance(enum pipe_format format)
|
||||
desc->swizzle[1] == PIPE_SWIZZLE_X &&
|
||||
desc->swizzle[2] == PIPE_SWIZZLE_X &&
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_1) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_alpha(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
@@ -163,12 +163,12 @@ util_format_is_alpha(enum pipe_format format)
|
||||
desc->swizzle[1] == PIPE_SWIZZLE_0 &&
|
||||
desc->swizzle[2] == PIPE_SWIZZLE_0 &&
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_X) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_pure_integer(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
@@ -185,12 +185,12 @@ util_format_is_pure_integer(enum pipe_format format)
|
||||
/* Find the first non-void channel. */
|
||||
i = util_format_get_first_non_void_channel(format);
|
||||
if (i == -1)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return desc->channel[i].pure_integer ? TRUE : FALSE;
|
||||
return desc->channel[i].pure_integer ? true : false;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_pure_sint(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
@@ -198,12 +198,12 @@ util_format_is_pure_sint(enum pipe_format format)
|
||||
|
||||
i = util_format_get_first_non_void_channel(format);
|
||||
if (i == -1)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
|
||||
return (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[i].pure_integer) ? true : false;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_pure_uint(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
@@ -211,15 +211,15 @@ util_format_is_pure_uint(enum pipe_format format)
|
||||
|
||||
i = util_format_get_first_non_void_channel(format);
|
||||
if (i == -1)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
|
||||
return (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED && desc->channel[i].pure_integer) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the format contains normalized signed channels.
|
||||
*/
|
||||
boolean
|
||||
bool
|
||||
util_format_is_snorm(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
@@ -230,7 +230,7 @@ util_format_is_snorm(enum pipe_format format)
|
||||
/**
|
||||
* Returns true if the format contains normalized unsigned channels.
|
||||
*/
|
||||
boolean
|
||||
bool
|
||||
util_format_is_unorm(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
@@ -241,7 +241,7 @@ util_format_is_unorm(enum pipe_format format)
|
||||
/**
|
||||
* Returns true if the format contains scaled integer format channels.
|
||||
*/
|
||||
boolean
|
||||
bool
|
||||
util_format_is_scaled(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
@@ -249,30 +249,30 @@ util_format_is_scaled(enum pipe_format format)
|
||||
|
||||
/* format none is described as scaled but not for this check */
|
||||
if (format == PIPE_FORMAT_NONE)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
/* Find the first non-void channel. */
|
||||
i = util_format_get_first_non_void_channel(format);
|
||||
if (i == -1)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return !desc->channel[i].pure_integer && !desc->channel[i].normalized &&
|
||||
(desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED ||
|
||||
desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED);
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
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;
|
||||
return false;
|
||||
|
||||
i = util_format_get_first_non_void_channel(format);
|
||||
if (i == -1)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED &&
|
||||
!desc->channel[i].pure_integer &&
|
||||
@@ -280,7 +280,7 @@ util_format_is_snorm8(enum pipe_format format)
|
||||
desc->channel[i].size == 8;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_luminance_alpha(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
@@ -292,13 +292,13 @@ util_format_is_luminance_alpha(enum pipe_format format)
|
||||
desc->swizzle[1] == PIPE_SWIZZLE_X &&
|
||||
desc->swizzle[2] == PIPE_SWIZZLE_X &&
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_Y) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_intensity(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
@@ -310,12 +310,12 @@ util_format_is_intensity(enum pipe_format format)
|
||||
desc->swizzle[1] == PIPE_SWIZZLE_X &&
|
||||
desc->swizzle[2] == PIPE_SWIZZLE_X &&
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_X) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_subsampled_422(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
@@ -511,31 +511,31 @@ util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_
|
||||
* r10g10b10a2_uscaled -> r10g10b10x2_uscaled
|
||||
* r10sg10sb10sa2u_norm -> r10g10b10x2_snorm
|
||||
*/
|
||||
boolean
|
||||
bool
|
||||
util_is_format_compatible(const struct util_format_description *src_desc,
|
||||
const struct util_format_description *dst_desc)
|
||||
{
|
||||
unsigned chan;
|
||||
|
||||
if (src_desc->format == dst_desc->format) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (src_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||
|
||||
dst_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src_desc->block.bits != dst_desc->block.bits ||
|
||||
src_desc->nr_channels != dst_desc->nr_channels ||
|
||||
src_desc->colorspace != dst_desc->colorspace) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (chan = 0; chan < 4; ++chan) {
|
||||
if (src_desc->channel[chan].size !=
|
||||
dst_desc->channel[chan].size) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,22 +544,22 @@ util_is_format_compatible(const struct util_format_description *src_desc,
|
||||
|
||||
if (swizzle < 4) {
|
||||
if (src_desc->swizzle[chan] != swizzle) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if ((src_desc->channel[swizzle].type !=
|
||||
dst_desc->channel[swizzle].type) ||
|
||||
(src_desc->channel[swizzle].normalized !=
|
||||
dst_desc->channel[swizzle].normalized)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_fits_8unorm(const struct util_format_description *format_desc)
|
||||
{
|
||||
unsigned chan;
|
||||
@@ -569,7 +569,7 @@ util_format_fits_8unorm(const struct util_format_description *format_desc)
|
||||
*/
|
||||
|
||||
if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (format_desc->layout) {
|
||||
@@ -578,23 +578,23 @@ util_format_fits_8unorm(const struct util_format_description *format_desc)
|
||||
/*
|
||||
* These are straight forward.
|
||||
*/
|
||||
return TRUE;
|
||||
return true;
|
||||
case UTIL_FORMAT_LAYOUT_RGTC:
|
||||
if (format_desc->format == PIPE_FORMAT_RGTC1_SNORM ||
|
||||
format_desc->format == PIPE_FORMAT_RGTC2_SNORM ||
|
||||
format_desc->format == PIPE_FORMAT_LATC1_SNORM ||
|
||||
format_desc->format == PIPE_FORMAT_LATC2_SNORM)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return false;
|
||||
return true;
|
||||
case UTIL_FORMAT_LAYOUT_BPTC:
|
||||
if (format_desc->format == PIPE_FORMAT_BPTC_RGBA_UNORM)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
|
||||
case UTIL_FORMAT_LAYOUT_ETC:
|
||||
if (format_desc->format == PIPE_FORMAT_ETC1_RGB8)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
|
||||
case UTIL_FORMAT_LAYOUT_PLAIN:
|
||||
/*
|
||||
@@ -608,14 +608,14 @@ util_format_fits_8unorm(const struct util_format_description *format_desc)
|
||||
case UTIL_FORMAT_TYPE_UNSIGNED:
|
||||
if (!format_desc->channel[chan].normalized ||
|
||||
format_desc->channel[chan].size > 8) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
default:
|
||||
/*
|
||||
@@ -628,16 +628,16 @@ util_format_fits_8unorm(const struct util_format_description *format_desc)
|
||||
case PIPE_FORMAT_YUYV:
|
||||
case PIPE_FORMAT_R8G8_B8G8_UNORM:
|
||||
case PIPE_FORMAT_G8R8_G8B8_UNORM:
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_translate(enum pipe_format dst_format,
|
||||
void *dst, unsigned dst_stride,
|
||||
unsigned dst_x, unsigned dst_y,
|
||||
@@ -669,7 +669,7 @@ util_format_translate(enum pipe_format dst_format,
|
||||
util_copy_rect(dst, dst_format, dst_stride, dst_x, dst_y,
|
||||
width, height, src, (int)src_stride,
|
||||
src_x, src_y);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(dst_x % dst_format_desc->block.width == 0);
|
||||
@@ -733,7 +733,7 @@ util_format_translate(enum pipe_format dst_format,
|
||||
|
||||
free(tmp_z);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (util_format_fits_8unorm(src_format_desc) ||
|
||||
@@ -743,13 +743,13 @@ util_format_translate(enum pipe_format dst_format,
|
||||
|
||||
if ((!unpack->unpack_rgba_8unorm && !unpack->unpack_rgba_8unorm_rect) ||
|
||||
!pack->pack_rgba_8unorm) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
|
||||
tmp_row = malloc(y_step * tmp_stride);
|
||||
if (!tmp_row)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
while (height >= y_step) {
|
||||
util_format_unpack_rgba_8unorm_rect(src_format, tmp_row, tmp_stride, src_row, src_stride, width, y_step);
|
||||
@@ -774,13 +774,13 @@ util_format_translate(enum pipe_format dst_format,
|
||||
|
||||
if (util_format_is_pure_sint(src_format) !=
|
||||
util_format_is_pure_sint(dst_format)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
|
||||
tmp_row = malloc(y_step * tmp_stride);
|
||||
if (!tmp_row)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
while (height >= y_step) {
|
||||
util_format_unpack_rgba_rect(src_format, tmp_row, tmp_stride, src_row, src_stride, width, y_step);
|
||||
@@ -805,13 +805,13 @@ util_format_translate(enum pipe_format dst_format,
|
||||
|
||||
if ((!unpack->unpack_rgba && !unpack->unpack_rgba_rect) ||
|
||||
!pack->pack_rgba_uint) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
|
||||
tmp_row = malloc(y_step * tmp_stride);
|
||||
if (!tmp_row)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
while (height >= y_step) {
|
||||
util_format_unpack_rgba_rect(src_format, tmp_row, tmp_stride, src_row, src_stride, width, y_step);
|
||||
@@ -835,13 +835,13 @@ util_format_translate(enum pipe_format dst_format,
|
||||
|
||||
if ((!unpack->unpack_rgba && !unpack->unpack_rgba_rect) ||
|
||||
!pack->pack_rgba_float) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
tmp_stride = MAX2(width, x_step) * 4 * sizeof *tmp_row;
|
||||
tmp_row = malloc(y_step * tmp_stride);
|
||||
if (!tmp_row)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
while (height >= y_step) {
|
||||
util_format_unpack_rgba_rect(src_format, tmp_row, tmp_stride, src_row, src_stride, width, y_step);
|
||||
@@ -859,10 +859,10 @@ util_format_translate(enum pipe_format dst_format,
|
||||
|
||||
free(tmp_row);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_translate_3d(enum pipe_format dst_format,
|
||||
void *dst, unsigned dst_stride,
|
||||
unsigned dst_slice_stride,
|
||||
@@ -888,12 +888,12 @@ util_format_translate_3d(enum pipe_format dst_format,
|
||||
src_format, src_layer, src_stride,
|
||||
src_x, src_y,
|
||||
width, height))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
dst_layer += dst_slice_stride;
|
||||
src_layer += src_slice_stride;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void util_format_compose_swizzles(const unsigned char swz1[4],
|
||||
@@ -911,7 +911,7 @@ void util_format_compose_swizzles(const unsigned char swz1[4],
|
||||
void util_format_apply_color_swizzle(union pipe_color_union *dst,
|
||||
const union pipe_color_union *src,
|
||||
const unsigned char swz[4],
|
||||
const boolean is_integer)
|
||||
const bool is_integer)
|
||||
{
|
||||
unsigned c;
|
||||
|
||||
|
||||
+49
-49
@@ -473,26 +473,26 @@ util_format_short_name(enum pipe_format format)
|
||||
/**
|
||||
* Whether this format is plain, see UTIL_FORMAT_LAYOUT_PLAIN for more info.
|
||||
*/
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_plain(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
if (!format) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ? TRUE : FALSE;
|
||||
return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN ? true : false;
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_compressed(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(desc);
|
||||
if (!desc) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (desc->layout) {
|
||||
@@ -504,81 +504,81 @@ util_format_is_compressed(enum pipe_format format)
|
||||
case UTIL_FORMAT_LAYOUT_ATC:
|
||||
case UTIL_FORMAT_LAYOUT_FXT1:
|
||||
/* XXX add other formats in the future */
|
||||
return TRUE;
|
||||
return true;
|
||||
default:
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_s3tc(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(desc);
|
||||
if (!desc) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return desc->layout == UTIL_FORMAT_LAYOUT_S3TC ? TRUE : FALSE;
|
||||
return desc->layout == UTIL_FORMAT_LAYOUT_S3TC ? true : false;
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_etc(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(desc);
|
||||
if (!desc) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return desc->layout == UTIL_FORMAT_LAYOUT_ETC ? TRUE : FALSE;
|
||||
return desc->layout == UTIL_FORMAT_LAYOUT_ETC ? true : false;
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
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
|
||||
static inline bool
|
||||
util_format_has_depth(const struct util_format_description *desc)
|
||||
{
|
||||
return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
|
||||
desc->swizzle[0] != PIPE_SWIZZLE_NONE;
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_has_stencil(const struct util_format_description *desc)
|
||||
{
|
||||
return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
|
||||
desc->swizzle[1] != PIPE_SWIZZLE_NONE;
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_depth_or_stencil(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(desc);
|
||||
if (!desc) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return util_format_has_depth(desc) ||
|
||||
util_format_has_stencil(desc);
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_depth_and_stencil(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(desc);
|
||||
if (!desc) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return util_format_has_depth(desc) &&
|
||||
@@ -606,14 +606,14 @@ util_format_get_depth_only(enum pipe_format format)
|
||||
}
|
||||
}
|
||||
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_yuv(enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
|
||||
assert(desc);
|
||||
if (!desc) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV;
|
||||
@@ -711,65 +711,65 @@ util_format_colormask(const struct util_format_description *desc)
|
||||
* @param desc a format description to check colormask with
|
||||
* @param colormask a bit mask for channels, matches format of PIPE_MASK_RGBA
|
||||
*/
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_colormask_full(const struct util_format_description *desc, unsigned colormask)
|
||||
{
|
||||
return (~colormask & util_format_colormask(desc)) == 0;
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_float(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_has_alpha(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_has_alpha1(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_luminance(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_alpha(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_luminance_alpha(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_intensity(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_subsampled_422(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_pure_integer(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_pure_sint(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_pure_uint(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_snorm(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_unorm(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_snorm8(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_is_scaled(enum pipe_format format) ATTRIBUTE_CONST;
|
||||
/**
|
||||
* Check if the src format can be blitted to the destination format with
|
||||
* a simple memcpy. For example, blitting from RGBA to RGBx is OK, but not
|
||||
* the reverse.
|
||||
*/
|
||||
boolean
|
||||
bool
|
||||
util_is_format_compatible(const struct util_format_description *src_desc,
|
||||
const struct util_format_description *dst_desc) ATTRIBUTE_CONST;
|
||||
|
||||
@@ -780,7 +780,7 @@ util_is_format_compatible(const struct util_format_description *src_desc,
|
||||
*
|
||||
* PIPE_FORMAT_?8?8?8?8_UNORM
|
||||
*/
|
||||
static inline boolean
|
||||
static inline bool
|
||||
util_format_is_rgba8_variant(const struct util_format_description *desc)
|
||||
{
|
||||
unsigned chan;
|
||||
@@ -788,20 +788,20 @@ util_format_is_rgba8_variant(const struct util_format_description *desc)
|
||||
if(desc->block.width != 1 ||
|
||||
desc->block.height != 1 ||
|
||||
desc->block.bits != 32)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
for(chan = 0; chan < 4; ++chan) {
|
||||
if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED &&
|
||||
desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID)
|
||||
return FALSE;
|
||||
return false;
|
||||
if(desc->channel[chan].type == UTIL_FORMAT_TYPE_UNSIGNED &&
|
||||
!desc->channel[chan].normalized)
|
||||
return FALSE;
|
||||
return false;
|
||||
if(desc->channel[chan].size != 8)
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1627,10 +1627,10 @@ util_format_unpack_rgba_8unorm_rect(enum pipe_format format,
|
||||
* Generic format conversion;
|
||||
*/
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_fits_8unorm(const struct util_format_description *format_desc) ATTRIBUTE_CONST;
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_translate(enum pipe_format dst_format,
|
||||
void *dst, unsigned dst_stride,
|
||||
unsigned dst_x, unsigned dst_y,
|
||||
@@ -1639,7 +1639,7 @@ util_format_translate(enum pipe_format dst_format,
|
||||
unsigned src_x, unsigned src_y,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
boolean
|
||||
bool
|
||||
util_format_translate_3d(enum pipe_format dst_format,
|
||||
void *dst, unsigned dst_stride,
|
||||
unsigned dst_slice_stride,
|
||||
@@ -1672,7 +1672,7 @@ void util_format_compose_swizzles(const unsigned char swz1[4],
|
||||
void util_format_apply_color_swizzle(union pipe_color_union *dst,
|
||||
const union pipe_color_union *src,
|
||||
const unsigned char swz[4],
|
||||
const boolean is_integer);
|
||||
const bool is_integer);
|
||||
|
||||
void pipe_swizzle_4f(float *dst, const float *src,
|
||||
const unsigned char swz[4]);
|
||||
|
||||
@@ -1549,7 +1549,7 @@ static inline void
|
||||
util_format_fxtn_rgb_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride,
|
||||
const uint8_t *restrict src_row, unsigned src_stride,
|
||||
unsigned width, unsigned height,
|
||||
boolean rgba)
|
||||
bool rgba)
|
||||
{
|
||||
const unsigned bw = 8, bh = 4, comps = 4;
|
||||
unsigned x, y, i, j;
|
||||
@@ -1596,7 +1596,7 @@ static inline void
|
||||
util_format_fxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
||||
const uint8_t *restrict src_row, unsigned src_stride,
|
||||
unsigned width, unsigned height,
|
||||
boolean rgba)
|
||||
bool rgba)
|
||||
{
|
||||
const unsigned bw = 8, bh = 4, comps = 4;
|
||||
unsigned x, y, i, j;
|
||||
|
||||
@@ -124,7 +124,7 @@ util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_
|
||||
const uint8_t *restrict src_row, unsigned src_stride,
|
||||
unsigned width, unsigned height,
|
||||
util_format_dxtn_fetch_t fetch,
|
||||
unsigned block_size, boolean srgb)
|
||||
unsigned block_size, bool srgb)
|
||||
{
|
||||
const unsigned bw = 4, bh = 4, comps = 4;
|
||||
unsigned x, y, i, j;
|
||||
@@ -159,7 +159,7 @@ util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgb_fetch,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -171,7 +171,7 @@ util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgba_fetch,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -183,7 +183,7 @@ util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt3_rgba_fetch,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -195,7 +195,7 @@ util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt5_rgba_fetch,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -203,7 +203,7 @@ util_format_dxtn_rgb_unpack_rgba_float(float *restrict dst_row, unsigned dst_str
|
||||
const uint8_t *restrict src_row, unsigned src_stride,
|
||||
unsigned width, unsigned height,
|
||||
util_format_dxtn_fetch_t fetch,
|
||||
unsigned block_size, boolean srgb)
|
||||
unsigned block_size, bool srgb)
|
||||
{
|
||||
unsigned x, y, i, j;
|
||||
for(y = 0; y < height; y += 4) {
|
||||
@@ -242,7 +242,7 @@ util_format_dxt1_rgb_unpack_rgba_float(void *restrict dst_row, unsigned dst_stri
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgb_fetch,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -254,7 +254,7 @@ util_format_dxt1_rgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_str
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgba_fetch,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -266,7 +266,7 @@ util_format_dxt3_rgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_str
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt3_rgba_fetch,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -278,7 +278,7 @@ util_format_dxt5_rgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_str
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt5_rgba_fetch,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ util_format_dxtn_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_stride
|
||||
const uint8_t *restrict src, unsigned src_stride,
|
||||
unsigned width, unsigned height,
|
||||
enum util_format_dxtn format,
|
||||
unsigned block_size, boolean srgb)
|
||||
unsigned block_size, bool srgb)
|
||||
{
|
||||
const unsigned bw = 4, bh = 4, comps = 4;
|
||||
unsigned x, y, i, j, k;
|
||||
@@ -331,7 +331,7 @@ util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_st
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -341,7 +341,7 @@ util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_s
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -351,7 +351,7 @@ util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_s
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -361,7 +361,7 @@ util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_s
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -369,7 +369,7 @@ util_format_dxtn_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_stride,
|
||||
const float *restrict src, unsigned src_stride,
|
||||
unsigned width, unsigned height,
|
||||
enum util_format_dxtn format,
|
||||
unsigned block_size, boolean srgb)
|
||||
unsigned block_size, bool srgb)
|
||||
{
|
||||
unsigned x, y, i, j, k;
|
||||
for(y = 0; y < height; y += 4) {
|
||||
@@ -407,7 +407,7 @@ util_format_dxt1_rgb_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_str
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -417,7 +417,7 @@ util_format_dxt1_rgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_st
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
||||
8, FALSE);
|
||||
8, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -427,7 +427,7 @@ util_format_dxt3_rgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_st
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -437,7 +437,7 @@ util_format_dxt5_rgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_st
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
||||
16, FALSE);
|
||||
16, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgb_fetch,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -554,7 +554,7 @@ util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned ds
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgba_fetch,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -564,7 +564,7 @@ util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned ds
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt3_rgba_fetch,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -574,7 +574,7 @@ util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *restrict dst_row, unsigned ds
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt5_rgba_fetch,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -584,7 +584,7 @@ util_format_dxt1_srgb_unpack_rgba_float(void *restrict dst_row, unsigned dst_str
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgb_fetch,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -594,7 +594,7 @@ util_format_dxt1_srgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_st
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt1_rgba_fetch,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -604,7 +604,7 @@ util_format_dxt3_srgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_st
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt3_rgba_fetch,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -614,7 +614,7 @@ util_format_dxt5_srgba_unpack_rgba_float(void *restrict dst_row, unsigned dst_st
|
||||
src_row, src_stride,
|
||||
width, height,
|
||||
util_format_dxt5_rgba_fetch,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -622,7 +622,7 @@ util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_s
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -630,7 +630,7 @@ util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -638,7 +638,7 @@ util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -646,7 +646,7 @@ util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *restrict dst_row, unsigned dst_
|
||||
{
|
||||
util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -654,7 +654,7 @@ util_format_dxt1_srgb_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_st
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGB,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -662,7 +662,7 @@ util_format_dxt1_srgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_s
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT1_RGBA,
|
||||
8, TRUE);
|
||||
8, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -670,7 +670,7 @@ util_format_dxt3_srgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_s
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT3_RGBA,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -678,6 +678,6 @@ util_format_dxt5_srgba_pack_rgba_float(uint8_t *restrict dst_row, unsigned dst_s
|
||||
{
|
||||
util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src_row, src_stride,
|
||||
width, height, UTIL_FORMAT_DXT5_RGBA,
|
||||
16, TRUE);
|
||||
16, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ type_map = {
|
||||
|
||||
def bool_map(value):
|
||||
if value:
|
||||
return "TRUE"
|
||||
return "true"
|
||||
else:
|
||||
return "FALSE"
|
||||
return "false"
|
||||
|
||||
|
||||
swizzle_map = {
|
||||
|
||||
Reference in New Issue
Block a user