vkr: add vkr_find_prev_struct

Add a helper to return the previous struct of the found struct with
input sType. This is useful for swapping a struct with something else.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by Ryan Neph <ryanneph@google.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
macos/master
Yiwei Zhang 3 years ago
parent 3f23dd679c
commit a9d035ffa6
  1. 15
      src/venus/vkr_common.h

@ -187,6 +187,21 @@ vkr_find_struct(const void *chain, VkStructureType type)
return NULL; return NULL;
} }
/*
* Find struct in the pNext of chain and return its previous struct.
*/
static inline void *
vkr_find_prev_struct(const void *chain, VkStructureType type)
{
VkBaseOutStructure *prev = (VkBaseOutStructure *)chain;
while (prev->pNext) {
if (prev->pNext->sType == type)
return prev;
prev = prev->pNext;
}
return NULL;
}
static inline bool static inline bool
vkr_is_recognized_object_type(VkObjectType type) vkr_is_recognized_object_type(VkObjectType type)
{ {

Loading…
Cancel
Save