From 2fa267d9e39faeadb96e5d8e43fb7f7f3243b9fe 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: (cherry picked from commit bf76e5bb38a42ba2f2fa2619b58701efd573fa4f) --- .pick_status.json | 2 +- src/gallium/drivers/r600/r600_formats.h | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2b5216f5378..6e65060335f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5144,7 +5144,7 @@ "description": "r600: refactor r600_is_buffer_format_supported() for the next update", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null 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; }