r600: Use get_first_non_void_channel more often

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18634>
This commit is contained in:
Konstantin Seurer
2022-09-16 16:12:15 +02:00
committed by Marge Bot
parent 9a452a97d9
commit cc8b398c96
5 changed files with 8 additions and 35 deletions
+2 -10
View File
@@ -1069,11 +1069,7 @@ static void evergreen_set_color_surface_buffer(struct r600_context *rctx,
endian = r600_colorformat_endian_swap(format, FALSE);
desc = util_format_description(pformat);
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
i = util_format_get_first_non_void_channel(pformat);
ntype = V_028C70_NUMBER_UNORM;
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
ntype = V_028C70_NUMBER_SRGB;
@@ -1179,11 +1175,7 @@ static void evergreen_set_color_surface_common(struct r600_context *rctx,
}
nbanks = eg_num_banks(rscreen->b.info.r600_num_banks);
desc = util_format_description(pformat);
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
i = util_format_get_first_non_void_channel(pformat);
color->attrib = S_028C74_TILE_SPLIT(tile_split)|
S_028C74_NUM_BANKS(nbanks) |
S_028C74_BANK_WIDTH(bankw) |
+1 -6
View File
@@ -2657,12 +2657,7 @@ void r600_vertex_data_type(enum pipe_format pformat,
goto out_unknown;
}
/* Find the first non-VOID channel. */
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
i = util_format_get_first_non_void_channel(pformat);
*endian = r600_endian_swap(desc->channel[i].size);
+2 -6
View File
@@ -90,12 +90,8 @@ static inline bool r600_is_buffer_format_supported(enum pipe_format format, bool
if (format == PIPE_FORMAT_R11G11B10_FLOAT)
return true;
/* Find the first non-VOID channel. */
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID)
break;
}
if (i == 4)
i = util_format_get_first_non_void_channel(format);
if (i == -1)
return false;
/* No fixed, no double. */
+1 -5
View File
@@ -854,11 +854,7 @@ static void r600_init_color_surface(struct r600_context *rctx,
desc = util_format_description(surf->base.format);
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
i = util_format_get_first_non_void_channel(surf->base.format);
ntype = V_0280A0_NUMBER_UNORM;
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
+2 -8
View File
@@ -3036,14 +3036,8 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen,
goto out_unknown;
}
/* Find the first non-VOID channel. */
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
if (i == 4)
i = util_format_get_first_non_void_channel(format);
if (i == -1)
goto out_unknown;
/* uniform formats */