r300: Use get_first_non_void_channel more often

Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18634>
This commit is contained in:
Konstantin Seurer
2022-09-16 16:06:26 +02:00
committed by Marge Bot
parent ad8de42ce5
commit 9a452a97d9
2 changed files with 7 additions and 26 deletions
@@ -340,7 +340,7 @@ static inline uint16_t
r300_translate_vertex_data_type(enum pipe_format format) {
uint32_t result = 0;
const struct util_format_description *desc;
unsigned i;
int i = util_format_get_first_non_void_channel(format);
if (!format)
format = PIPE_FORMAT_R32_FLOAT;
@@ -351,13 +351,6 @@ r300_translate_vertex_data_type(enum pipe_format format) {
return R300_INVALID_FORMAT;
}
/* Find the first non-VOID channel. */
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
switch (desc->channel[i].type) {
/* Half-floats, floats, doubles */
case UTIL_FORMAT_TYPE_FLOAT:
+6 -18
View File
@@ -169,7 +169,7 @@ uint32_t r300_translate_texformat(enum pipe_format format,
{
uint32_t result = 0;
const struct util_format_description *desc;
unsigned i;
int i;
boolean uniform = TRUE;
const uint32_t sign_bit[4] = {
R300_TX_FORMAT_SIGNED_W,
@@ -358,14 +358,8 @@ uint32_t r300_translate_texformat(enum pipe_format format,
return ~0; /* Unsupported/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)
return ~0; /* Unsupported/unknown. */
/* And finally, uniform formats. */
@@ -591,21 +585,15 @@ static uint32_t r300_translate_zsformat(enum pipe_format format)
static uint32_t r300_translate_out_fmt(enum pipe_format format)
{
uint32_t modifier = 0;
unsigned i;
int i;
const struct util_format_description *desc;
boolean uniform_sign;
format = r300_unbyteswap_array_format(format);
desc = util_format_description(format);
/* 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 ~0; /* Unsupported/unknown. */
/* Specifies how the shader output is written to the fog unit. */