mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 11:00:11 +01:00
vk/util: add a util macro for initializing stack vk_shader_module structs
radv does a lot of this, so having a central dispatch point will be useful in case changes are made to this struct in the future Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9508>
This commit is contained in:
parent
76078ed9fe
commit
a41e98ddca
1 changed files with 13 additions and 0 deletions
|
|
@ -43,6 +43,19 @@ struct vk_shader_module {
|
|||
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(vk_shader_module, base, VkShaderModule,
|
||||
VK_OBJECT_TYPE_SHADER_MODULE)
|
||||
|
||||
/* this should only be used for stack-allocated, temporary objects */
|
||||
#define vk_shader_module_handle_from_nir(_nir) \
|
||||
vk_shader_module_to_handle(&(struct vk_shader_module) { \
|
||||
.base.type = VK_OBJECT_TYPE_SHADER_MODULE, \
|
||||
.nir = _nir, \
|
||||
})
|
||||
#define vk_shader_module_from_nir(_nir) \
|
||||
(struct vk_shader_module) { \
|
||||
.base.type = VK_OBJECT_TYPE_SHADER_MODULE, \
|
||||
.nir = _nir, \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue