From d49de8f10a7facc4e566851aa3dbbff1d032a372 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Wed, 7 May 2025 20:33:45 +0200 Subject: [PATCH] util: Add util_format_is_int64 util_format_is_int64 returns true for pure 64-bit integer (sint64 and uint64) formats. Reviewed-by: Mike Blumenkrantz Part-of: --- src/gallium/drivers/llvmpipe/lp_screen.c | 9 ++------- src/util/format/u_format.h | 7 +++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 2be6f242f77..1c0b99a835f 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -635,13 +635,8 @@ llvmpipe_is_format_supported(struct pipe_screen *_screen, /* Disable 64-bit integer formats for RT/samplers. * VK CTS crashes with these and they don't make much sense. */ - int c = util_format_get_first_non_void_channel(format_desc->format); - if (c >= 0) { - if (format_desc->channel[c].pure_integer && - format_desc->channel[c].size == 64) - return false; - } - + if (util_format_is_int64(format_desc)) + return false; } if (!(bind & PIPE_BIND_VERTEX_BUFFER) && diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h index 95976ec14a6..fa8516780c8 100644 --- a/src/util/format/u_format.h +++ b/src/util/format/u_format.h @@ -1399,6 +1399,13 @@ util_format_is_unorm8(const struct util_format_description *desc) return desc->is_unorm && desc->is_array && desc->channel[c].size == 8; } +static inline bool +util_format_is_int64(const struct util_format_description *desc) +{ + int c = util_format_get_first_non_void_channel(desc->format); + return c >= 0 && desc->channel[c].pure_integer && desc->channel[c].size == 64; +} + static inline void util_format_unpack_z_float(enum pipe_format format, float *dst, const void *src, unsigned w)