gen += 5;
for (format = MESA_FORMAT_NONE + 1; format < MESA_FORMAT_COUNT; format++) {
+ if (!_mesa_get_format_name(format))
+ continue;
enum isl_format texture, render;
bool is_integer = _mesa_is_format_integer_color(format);
}
for fmat in formats:
- print(' {')
+ print(' [{0}] = {{'.format(fmat.name))
print(' .Name = {0},'.format(fmat.name))
print(' .StrName = "{0}",'.format(fmat.name))
print(' .Layout = {0},'.format('MESA_FORMAT_LAYOUT_' + fmat.layout.upper()))
{
const struct mesa_format_info *info = &format_info[format];
STATIC_ASSERT(ARRAY_SIZE(format_info) == MESA_FORMAT_COUNT);
+
+ /* The MESA_FORMAT_* enums are sparse, don't return a format info
+ * for empty entries.
+ */
+ if (info->Name == MESA_FORMAT_NONE && format != MESA_FORMAT_NONE)
+ return NULL;
+
assert(info->Name == format);
return info;
}
_mesa_get_format_name(mesa_format format)
{
const struct mesa_format_info *info = _mesa_get_format_info(format);
+ if (!info)
+ return NULL;
return info->StrName;
}
for (f = 1; f < MESA_FORMAT_COUNT; ++f) {
info = _mesa_get_format_info(f);
- if (!info->ArrayFormat)
+ if (!info || !info->ArrayFormat)
continue;
#if UTIL_ARCH_LITTLE_ENDIAN
case MESA_FORMAT_COUNT:
assert(0);
return;
- default:
+ default: {
+ const char *name = _mesa_get_format_name(format);
/* Warn if any formats are not handled */
_mesa_problem(NULL, "bad format %s in _mesa_uncompressed_format_to_type_and_comps",
- _mesa_get_format_name(format));
+ name ? name : "???");
assert(format == MESA_FORMAT_NONE ||
_mesa_is_format_compressed(format));
*datatype = 0;
*comps = 1;
}
+ }
}
/**
mesa_format f = (mesa_format) fi;
SCOPED_TRACE(_mesa_get_format_name(f));
+ if (!_mesa_get_format_name(f))
+ continue;
+
/* This function will emit a problem/warning if the format is
* not handled.
*/
for (int fi = 0; fi < MESA_FORMAT_COUNT; ++fi) {
mesa_format f = (mesa_format) fi;
SCOPED_TRACE(_mesa_get_format_name(f));
+ if (!_mesa_get_format_name(f))
+ continue;
+
GLenum datatype = _mesa_get_format_datatype(f);
GLint r = _mesa_get_format_bits(f, GL_RED_BITS);
GLint g = _mesa_get_format_bits(f, GL_GREEN_BITS);
mesa_format mesa_format;
for (mesa_format = 1; mesa_format < MESA_FORMAT_COUNT; mesa_format++) {
+ if (!_mesa_get_format_name(mesa_format))
+ continue;
+
if (_mesa_is_format_srgb(mesa_format)) {
continue;
}
/* test all Mesa formats */
for (i = 1; i < MESA_FORMAT_COUNT; i++) {
+ if (!_mesa_get_format_name(i))
+ continue;
+
enum pipe_format pf;
assert(!st_compressed_format_fallback(st, i));