vk/util: add macros for multidraw

this simplifies implementations since a lot of the code is going to be
copy/pasted around, enabling related tweaks to be made in a centralized place

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11496>
This commit is contained in:
Mike Blumenkrantz 2021-03-30 14:48:50 -04:00 committed by Marge Bot
parent 8c968b8301
commit 6d0aceae4d

View file

@ -255,6 +255,21 @@ mesa_to_vk_shader_stage(gl_shader_stage mesa_stage)
return (VkShaderStageFlagBits) (1 << ((uint32_t) mesa_stage));
}
/* iterate over a sequence of indexed multidraws for VK_EXT_multi_draw extension */
/* 'i' must be explicitly declared */
#define vk_foreach_multi_draw_indexed(_draw, _i, _pDrawInfo, _num_draws, _stride) \
for (const VkMultiDrawIndexedInfoEXT *_draw = (const void*)(_pDrawInfo); \
(_i) < (_num_draws); \
(_i)++, (_draw) = (const VkMultiDrawIndexedInfoEXT*)((const uint8_t*)(_draw) + (_stride)))
/* iterate over a sequence of multidraws for VK_EXT_multi_draw extension */
/* 'i' must be explicitly declared */
#define vk_foreach_multi_draw(_draw, _i, _pDrawInfo, _num_draws, _stride) \
for (const VkMultiDrawInfoEXT *_draw = (const void*)(_pDrawInfo); \
(_i) < (_num_draws); \
(_i)++, (_draw) = (const VkMultiDrawInfoEXT*)((const uint8_t*)(_draw) + (_stride)))
#ifdef __cplusplus
}
#endif