diff options
author | Jason Ekstrand <[email protected]> | 2017-03-13 19:26:06 -0700 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-03-15 08:22:02 +1000 |
commit | 2e98db68e4f8a71f9c9723ed05cc7bfc096c3e0a (patch) | |
tree | c5561c9bcae783d827ec35b1c4c72391fe2e47ec /src | |
parent | e0cc32b85bd8cf5c2202037838a208983e2d793a (diff) |
util/vk: Add helpers for finding an extension struct
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/util/vk_util.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util/vk_util.h b/src/util/vk_util.h index 589d5c6f5d5..5ff1f00195c 100644 --- a/src/util/vk_util.h +++ b/src/util/vk_util.h @@ -180,4 +180,21 @@ __vk_outarray_next(struct __vk_outarray *a, size_t elem_size) for (vk_outarray_typeof_elem(a) *elem = vk_outarray_next(a); \ elem != NULL; elem = NULL) +static inline void * +__vk_find_struct(void *start, VkStructureType sType) +{ + vk_foreach_struct(s, start) { + if (s->sType == sType) + return s; + } + + return NULL; +} + +#define vk_find_struct(__start, __sType) \ + __vk_find_struct((__start), VK_STRUCTURE_TYPE_##__sType) + +#define vk_find_struct_const(__start, __sType) \ + (const void *)__vk_find_struct((void *)(__start), VK_STRUCTURE_TYPE_##__sType) + #endif /* VK_UTIL_H */ |