From 82a37541ff9fbaeaba9b97b122c0cb329e49ced4 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Thu, 21 May 2026 16:18:22 +0200 Subject: [PATCH] feature: add to_string support for callbacks Related-To: NEO-14577 Signed-off-by: Kamil Kopryk --- scripts/templates/validation/to_string.h.mako | 7 +++++++ source/utils/ze_to_string.h | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/scripts/templates/validation/to_string.h.mako b/scripts/templates/validation/to_string.h.mako index 9bffefad..563197b2 100644 --- a/scripts/templates/validation/to_string.h.mako +++ b/scripts/templates/validation/to_string.h.mako @@ -58,6 +58,13 @@ inline std::string to_string(${th.make_type_name(n, tags, obj)} handle) { return to_string(reinterpret_cast(handle)); } +%endfor +// Callback to_string functions (function pointers) +%for obj in th.extract_objs(specs, r"callback"): +inline std::string to_string(${th.make_type_name(n, tags, obj)} ptr) { + return to_string(reinterpret_cast(ptr)); +} + %endfor %endif %if n == 'ze': diff --git a/source/utils/ze_to_string.h b/source/utils/ze_to_string.h index f4249198..73b14709 100644 --- a/source/utils/ze_to_string.h +++ b/source/utils/ze_to_string.h @@ -120,6 +120,15 @@ inline std::string to_string(ze_rtas_parallel_operation_exp_handle_t handle) { return to_string(reinterpret_cast(handle)); } +// Callback to_string functions (function pointers) +inline std::string to_string(ze_rtas_geometry_aabbs_cb_ext_t ptr) { + return to_string(reinterpret_cast(ptr)); +} + +inline std::string to_string(ze_rtas_geometry_aabbs_cb_exp_t ptr) { + return to_string(reinterpret_cast(ptr)); +} + // For primitive types and Level Zero typedef'd types // Since most Level Zero types are typedef'd to uint32_t, we can't distinguish them by type inline std::string to_string(uint32_t value) { return std::to_string(value); }