summaryrefslogtreecommitdiffstats
path: root/src/freedreno
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-10-05 12:05:52 -0400
committerJonathan Marek <[email protected]>2019-10-15 07:56:19 -0400
commiteb67d9f0f3e8faf7015ed8884d36f94e6749aabb (patch)
tree90731d977d2e3696763020bb98bbfa7d606a5c4e /src/freedreno
parent12ede7565f47b7096bb1ff3fd92c5b0b54483634 (diff)
turnip: add format_is_uint/format_is_sint
Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/vulkan/vk_format.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/freedreno/vulkan/vk_format.h b/src/freedreno/vulkan/vk_format.h
index 4e13bc9c02d..bbf7a5d81b9 100644
--- a/src/freedreno/vulkan/vk_format.h
+++ b/src/freedreno/vulkan/vk_format.h
@@ -449,6 +449,28 @@ vk_format_is_int(VkFormat format)
}
static inline bool
+vk_format_is_uint(VkFormat format)
+{
+ const struct vk_format_description *desc = vk_format_description(format);
+ int channel = vk_format_get_first_non_void_channel(format);
+
+ return channel >= 0 &&
+ desc->channel[channel].pure_integer &&
+ desc->channel[channel].type != VK_FORMAT_TYPE_SIGNED;
+}
+
+static inline bool
+vk_format_is_sint(VkFormat format)
+{
+ const struct vk_format_description *desc = vk_format_description(format);
+ int channel = vk_format_get_first_non_void_channel(format);
+
+ return channel >= 0 &&
+ desc->channel[channel].pure_integer &&
+ desc->channel[channel].type == VK_FORMAT_TYPE_SIGNED;
+}
+
+static inline bool
vk_format_is_srgb(VkFormat format)
{
const struct vk_format_description *desc = vk_format_description(format);