From 9d34c0f7053475be1e4f39c5c4546fc350332166 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 1 May 2024 13:24:43 -0400 Subject: [PATCH] vulkan: add vk_debug_ignored_stype helper from nvk. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Faith Ekstrand Reviewed-by: Ivan Briano Part-of: --- src/vulkan/runtime/vk_log.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/vulkan/runtime/vk_log.h b/src/vulkan/runtime/vk_log.h index 5d0c230f2a8..c6d3b2ff61c 100644 --- a/src/vulkan/runtime/vk_log.h +++ b/src/vulkan/runtime/vk_log.h @@ -22,6 +22,7 @@ */ #include "vk_instance.h" +#include "vk_enum_to_str.h" #ifdef __cplusplus extern "C" { @@ -92,6 +93,27 @@ __vk_errorf(const void *_obj, VkResult error, const char *file, int line, const char *format, ...); +/** + * Warn on ignored extension structs. + * + * The Vulkan spec requires us to ignore unsupported or unknown structs in + * a pNext chain. In debug mode, emitting warnings for ignored structs may + * help us discover structs that we should not have ignored. + * + * From the Vulkan 1.0.38 spec: + * + * Any component of the implementation (the loader, any enabled layers, + * and drivers) must skip over, without processing (other than reading the + * sType and pNext members) any chained structures with sType values not + * defined by extensions supported by that component. + */ +#define vk_debug_ignored_stype(sType) \ + do { \ + const VkStructureType _type = (sType); \ + mesa_logd("%s: ignored VkStructureType %s(%u)\n", __func__, \ + vk_StructureType_to_str(_type), _type); \ + } while (0) + #ifdef __cplusplus } #endif \ No newline at end of file