From bf76e5bb38a42ba2f2fa2619b58701efd573fa4f Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Fri, 6 Jun 2025 13:21:18 +0200 Subject: [PATCH] r600: refactor r600_is_buffer_format_supported() for the next update The variable "i" is updated to the type returned by util_format_get_first_non_void_channel() which is int. The function is refactored to handle "for_vbo" as false. Cc: mesa-stable Signed-off-by: Patrick Lerda Part-of: --- src/gallium/drivers/r600/r600_formats.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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; }