Mesa (master): radv: add new vk_format_is_*() helpers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 23 18:13:26 UTC 2020


Module: Mesa
Branch: master
Commit: 684531fd37ca3aa15dfb34f34ada10615ff66864
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=684531fd37ca3aa15dfb34f34ada10615ff66864

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon Nov 16 08:55:10 2020 +0100

radv: add new vk_format_is_*() helpers

I think we should make RADV uses util_format everywhere.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7512>

---

 src/amd/vulkan/vk_format.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/amd/vulkan/vk_format.h b/src/amd/vulkan/vk_format.h
index b46093c56b7..29db70e7261 100644
--- a/src/amd/vulkan/vk_format.h
+++ b/src/amd/vulkan/vk_format.h
@@ -30,6 +30,7 @@
 #include <assert.h>
 #include <vulkan/vulkan.h>
 #include <util/macros.h>
+#include <vulkan/util/vk_format.h>
 
 enum vk_format_layout {
 	/**
@@ -436,6 +437,24 @@ vk_format_is_int(VkFormat format)
 	return channel >= 0 && desc->channel[channel].pure_integer;
 }
 
+static inline bool
+vk_format_is_uint(VkFormat format)
+{
+	return util_format_is_pure_uint(vk_format_to_pipe_format(format));
+}
+
+static inline bool
+vk_format_is_sint(VkFormat format)
+{
+	return util_format_is_pure_sint(vk_format_to_pipe_format(format));
+}
+
+static inline bool
+vk_format_is_unorm(VkFormat format)
+{
+	return util_format_is_unorm(vk_format_to_pipe_format(format));
+}
+
 static inline bool
 vk_format_is_srgb(VkFormat format)
 {



More information about the mesa-commit mailing list