From e84ad85fc28e9e14ab7d417237dc1c5230a10c60 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 4 Nov 2023 14:03:28 +0000 Subject: [PATCH] a/vk: Add object type to string helper --- src/xrt/auxiliary/vk/vk_helpers.c | 107 ++++++++++++++++++++++++++++++ src/xrt/auxiliary/vk/vk_helpers.h | 3 + 2 files changed, 110 insertions(+) diff --git a/src/xrt/auxiliary/vk/vk_helpers.c b/src/xrt/auxiliary/vk/vk_helpers.c index 8135d6410..397a3aa19 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.c +++ b/src/xrt/auxiliary/vk/vk_helpers.c @@ -160,6 +160,113 @@ vk_result_string(VkResult code) } } +XRT_CHECK_RESULT const char * +vk_object_type_string(VkObjectType type) +{ + switch (type) { + ENUM_TO_STR(VK_OBJECT_TYPE_UNKNOWN); + ENUM_TO_STR(VK_OBJECT_TYPE_INSTANCE); + ENUM_TO_STR(VK_OBJECT_TYPE_PHYSICAL_DEVICE); + ENUM_TO_STR(VK_OBJECT_TYPE_DEVICE); + ENUM_TO_STR(VK_OBJECT_TYPE_QUEUE); + ENUM_TO_STR(VK_OBJECT_TYPE_SEMAPHORE); + ENUM_TO_STR(VK_OBJECT_TYPE_COMMAND_BUFFER); + ENUM_TO_STR(VK_OBJECT_TYPE_FENCE); + ENUM_TO_STR(VK_OBJECT_TYPE_DEVICE_MEMORY); + ENUM_TO_STR(VK_OBJECT_TYPE_BUFFER); + ENUM_TO_STR(VK_OBJECT_TYPE_IMAGE); + ENUM_TO_STR(VK_OBJECT_TYPE_EVENT); + ENUM_TO_STR(VK_OBJECT_TYPE_QUERY_POOL); + ENUM_TO_STR(VK_OBJECT_TYPE_BUFFER_VIEW); + ENUM_TO_STR(VK_OBJECT_TYPE_IMAGE_VIEW); + ENUM_TO_STR(VK_OBJECT_TYPE_SHADER_MODULE); + ENUM_TO_STR(VK_OBJECT_TYPE_PIPELINE_CACHE); + ENUM_TO_STR(VK_OBJECT_TYPE_PIPELINE_LAYOUT); + ENUM_TO_STR(VK_OBJECT_TYPE_RENDER_PASS); + ENUM_TO_STR(VK_OBJECT_TYPE_PIPELINE); + ENUM_TO_STR(VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT); + ENUM_TO_STR(VK_OBJECT_TYPE_SAMPLER); + ENUM_TO_STR(VK_OBJECT_TYPE_DESCRIPTOR_POOL); + ENUM_TO_STR(VK_OBJECT_TYPE_DESCRIPTOR_SET); + ENUM_TO_STR(VK_OBJECT_TYPE_FRAMEBUFFER); + ENUM_TO_STR(VK_OBJECT_TYPE_COMMAND_POOL); +#ifdef VK_VERSION_1_1 + ENUM_TO_STR(VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE); +#elif defined(VK_KHR_descriptor_update_template) + ENUM_TO_STR(VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR); +#endif +#ifdef VK_VERSION_1_1 + ENUM_TO_STR(VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION); +#elif defined(VK_KHR_sampler_ycbcr_conversion) + ENUM_TO_STR(VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR); +#endif +#ifdef VK_VERSION_1_3 + ENUM_TO_STR(VK_OBJECT_TYPE_PRIVATE_DATA_SLOT); +#elif defined(VK_EXT_private_data) + ENUM_TO_STR(VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT); +#endif +#ifdef VK_KHR_surface + ENUM_TO_STR(VK_OBJECT_TYPE_SURFACE_KHR); +#endif +#ifdef VK_KHR_swapchain + ENUM_TO_STR(VK_OBJECT_TYPE_SWAPCHAIN_KHR); +#endif +#ifdef VK_KHR_display + ENUM_TO_STR(VK_OBJECT_TYPE_DISPLAY_KHR); + ENUM_TO_STR(VK_OBJECT_TYPE_DISPLAY_MODE_KHR); +#endif +#ifdef VK_EXT_debug_report + ENUM_TO_STR(VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT); +#endif +#ifdef VK_KHR_video_queue + ENUM_TO_STR(VK_OBJECT_TYPE_VIDEO_SESSION_KHR); + ENUM_TO_STR(VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR); +#endif +#ifdef VK_NVX_binary_import + ENUM_TO_STR(VK_OBJECT_TYPE_CU_MODULE_NVX); + ENUM_TO_STR(VK_OBJECT_TYPE_CU_FUNCTION_NVX); +#endif +#ifdef VK_EXT_debug_utils + ENUM_TO_STR(VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT); +#endif +#ifdef VK_KHR_acceleration_structure + ENUM_TO_STR(VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR); +#endif +#ifdef VK_EXT_validation_cache + ENUM_TO_STR(VK_OBJECT_TYPE_VALIDATION_CACHE_EXT); +#endif +#ifdef VK_NV_ray_tracing + ENUM_TO_STR(VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV); +#endif +#ifdef VK_INTEL_performance_query + ENUM_TO_STR(VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL); +#endif +#ifdef VK_KHR_deferred_host_operations + ENUM_TO_STR(VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR); +#endif +#ifdef VK_NV_device_generated_commands + ENUM_TO_STR(VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV); +#endif +#ifdef VK_NV_cuda_kernel_launch + ENUM_TO_STR(VK_OBJECT_TYPE_CUDA_MODULE_NV); + ENUM_TO_STR(VK_OBJECT_TYPE_CUDA_FUNCTION_NV); +#endif +#ifdef VK_FUCHSIA_buffer_collection + ENUM_TO_STR(VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA); +#endif +#ifdef VK_EXT_opacity_micromap + ENUM_TO_STR(VK_OBJECT_TYPE_MICROMAP_EXT); +#endif +#ifdef VK_NV_optical_flow + ENUM_TO_STR(VK_OBJECT_TYPE_OPTICAL_FLOW_SESSION_NV); +#endif +#ifdef VK_EXT_shader_object + ENUM_TO_STR(VK_OBJECT_TYPE_SHADER_EXT); +#endif + default: return "UNKNOWN OBJECT TYPE"; + } +} + XRT_CHECK_RESULT const char * vk_physical_device_type_string(VkPhysicalDeviceType device_type) { diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h index 6d1dd4ed9..994031074 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.h +++ b/src/xrt/auxiliary/vk/vk_helpers.h @@ -522,6 +522,9 @@ struct vk_buffer XRT_CHECK_RESULT const char * vk_result_string(VkResult code); +XRT_CHECK_RESULT const char * +vk_object_type_string(VkObjectType type); + XRT_CHECK_RESULT const char * vk_physical_device_type_string(VkPhysicalDeviceType device_type);