vulkan: add helpers to work with executable statistics

this is a lot of boilerplate in each driver. add helpers for it instead. the
common framework will use these internally, but drivers that don't want the
framework for whatever reason could use these themselves too.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33814>
This commit is contained in:
Alyssa Rosenzweig 2025-02-27 17:28:49 -05:00 committed by Marge Bot
parent 682723c0c4
commit 2a44266d57

View file

@ -412,6 +412,29 @@ vk_descriptor_type_is_dynamic(VkDescriptorType type)
memset(field + len, 0, sizeof(field) - len); \
} while(0)
#define vk_add_exec_statistic(out, name_, description_, format_enum, \
format_member, value_) \
vk_outarray_append_typed(VkPipelineExecutableStatisticKHR, &(out), stat) \
{ \
VK_COPY_STR(stat->name, name_); \
VK_COPY_STR(stat->description, description_); \
stat->format = \
VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_##format_enum##_KHR; \
stat->value.format_member = (value_); \
}
#define vk_add_exec_statistic_i64(out, name, description, value) \
vk_add_exec_statistic(out, name, description, INT64, i64, value)
#define vk_add_exec_statistic_u64(out, name, description, value) \
vk_add_exec_statistic(out, name, description, UINT64, u64, value)
#define vk_add_exec_statistic_f64(out, name, description, value) \
vk_add_exec_statistic(out, name, description, FLOAT64, f64, value)
#define vk_add_exec_statistic_bool(out, name, description, value) \
vk_add_exec_statistic(out, name, description, BOOL32, b32, value)
#ifdef __cplusplus
}
#endif