boolean
util_format_is_supported(enum pipe_format format, unsigned bind)
{
+ if (format >= PIPE_FORMAT_COUNT) {
+ return FALSE;
+ }
+
if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) {
return FALSE;
}
format = PIPE_FORMAT_A4R4_UNORM;
desc = util_format_description(format);
+ if (!desc)
+ goto out_unknown;
/* Depth and stencil swizzling is handled separately. */
if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) {
const struct util_format_description *desc = util_format_description(format);
int channel = util_format_get_first_non_void_channel(format);
bool is_float;
+ if (!desc)
+ return ~0U;
#define HAS_SIZE(x,y,z,w) \
(desc->channel[0].size == (x) && desc->channel[1].size == (y) && \
static uint32_t si_translate_colorformat(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
+ if (!desc)
+ return V_028C70_COLOR_INVALID;
#define HAS_SIZE(x,y,z,w) \
(desc->channel[0].size == (x) && desc->channel[1].size == (y) && \
static bool si_is_sampler_format_supported(struct pipe_screen *screen, enum pipe_format format)
{
- return si_translate_texformat(screen, format, util_format_description(format),
+ const struct util_format_description *desc = util_format_description(format);
+ if (!desc)
+ return false;
+
+ return si_translate_texformat(screen, format, desc,
util_format_get_first_non_void_channel(format)) != ~0U;
}
PIPE_BIND_VERTEX_BUFFER)) == 0);
desc = util_format_description(format);
+ if (!desc)
+ return 0;
/* There are no native 8_8_8 or 16_16_16 data formats, and we currently
* select 8_8_8_8 and 16_16_16_16 instead. This works reasonably well