vulkan: Add vk_index_type_to_bytes helper

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24017>
This commit is contained in:
Alyssa Rosenzweig
2023-07-06 08:58:54 -04:00
parent ce2252d265
commit b733fcb337
+12
View File
@@ -366,6 +366,18 @@ vk_spec_info_to_nir_spirv(const VkSpecializationInfo *spec_info,
#define STACK_ARRAY_FINISH(name) \
if (name != _stack_##name) free(name)
static inline uint8_t
vk_index_type_to_bytes(enum VkIndexType type)
{
switch (type) {
case VK_INDEX_TYPE_NONE_KHR: return 0;
case VK_INDEX_TYPE_UINT8_EXT: return 1;
case VK_INDEX_TYPE_UINT16: return 2;
case VK_INDEX_TYPE_UINT32: return 4;
default: unreachable("Invalid index type");
}
}
#ifdef __cplusplus
}
#endif