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:
committed by
Marge Bot
parent
9a452a97d9
commit
cc8b398c96
@@ -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) |
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user