summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_state_fs.c
diff options
context:
space:
mode:
authorKonstantin Seurer <konstantin.seurer@gmail.com>2022-09-22 19:39:11 +0200
committerMarge Bot <emma+marge@anholt.net>2022-12-02 22:06:11 +0000
commitef168a57b9c87cc3c120e5a750adde582dc2cad1 (patch)
tree20e0f909beeb2a435e5376f29410f8ca7551f6fe /src/gallium/drivers/llvmpipe/lp_state_fs.c
parentc94e3687d1e09a535a587c5ad2de220879db9481 (diff)
llvmpipe: 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>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_state_fs.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 86947651deb..61bbbf43d59 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -170,8 +170,6 @@ static inline void
lp_mem_type_from_format_desc(const struct util_format_description *format_desc,
struct lp_type* type)
{
- unsigned i;
-
if (format_expands_to_float_soa(format_desc)) {
/* just make this a uint with width of block */
type->floating = false;
@@ -183,11 +181,7 @@ lp_mem_type_from_format_desc(const struct util_format_description *format_desc,
return;
}
- for (i = 0; i < 4; i++) {
- if (format_desc->channel[i].type != UTIL_FORMAT_TYPE_VOID)
- break;
- }
- unsigned chan = i;
+ int chan = util_format_get_first_non_void_channel(format_desc->format);
memset(type, 0, sizeof(struct lp_type));
type->floating = format_desc->channel[chan].type == UTIL_FORMAT_TYPE_FLOAT;
@@ -1730,11 +1724,7 @@ lp_blend_type_from_format_desc(const struct util_format_description *format_desc
return;
}
- unsigned i;
- for (i = 0; i < 4; i++)
- if (format_desc->channel[i].type != UTIL_FORMAT_TYPE_VOID)
- break;
- const unsigned chan = i;
+ const int chan = util_format_get_first_non_void_channel(format_desc->format);
memset(type, 0, sizeof(struct lp_type));
type->floating = format_desc->channel[chan].type == UTIL_FORMAT_TYPE_FLOAT;