a/vk: Add object type to string helper

This commit is contained in:
Jakob Bornecrantz 2023-11-04 14:03:28 +00:00
parent 5b9e70f3a8
commit e84ad85fc2
2 changed files with 110 additions and 0 deletions

View file

@ -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)
{

View file

@ -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);