diff --git a/src/gallium/drivers/r600/r600_formats.h b/src/gallium/drivers/r600/r600_formats.h index 6a4a09805d5..79a9e2cce66 100644 --- a/src/gallium/drivers/r600/r600_formats.h +++ b/src/gallium/drivers/r600/r600_formats.h @@ -84,15 +84,17 @@ static inline unsigned r600_endian_swap(unsigned size) } } -static inline bool r600_is_buffer_format_supported(enum pipe_format format, bool for_vbo) +static inline bool +r600_is_buffer_format_supported(const enum pipe_format format, + const bool for_vbo) { const struct util_format_description *desc = util_format_description(format); - unsigned i; if (format == PIPE_FORMAT_R11G11B10_FLOAT) return true; - i = util_format_get_first_non_void_channel(format); + const int i = util_format_get_first_non_void_channel(format); + if (i == -1) return false; @@ -110,9 +112,11 @@ static inline bool r600_is_buffer_format_supported(enum pipe_format format, bool desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED)) return false; - /* No 8 bit 3 channel formats for TBOs */ - if (desc->channel[i].size == 8 && desc->nr_channels == 3) - return for_vbo; + if (!for_vbo) { + /* No 8 bit 3 channel formats for TBOs */ + if (desc->channel[i].size == 8 && desc->nr_channels == 3) + return false; + } return true; }