Skip to main content

bedrock_vk/
result_str.rs

1use crate::*;
2
3pub const fn result_to_str(r: VkResult) -> &'static str {
4    match r {
5        // Success Codes //
6        VK_SUCCESS => "Command successfully completed",
7        VK_NOT_READY => "A fence or query has not yet completed",
8        VK_TIMEOUT => "A wait operation has not completed in the specified time",
9        VK_EVENT_SET => "An event is signaled",
10        VK_EVENT_RESET => "An event is unsignaled",
11        VK_INCOMPLETE => "A return array was too small for the result",
12        #[cfg(feature = "VK_KHR_swapchain")]
13        VK_SUBOPTIMAL_KHR => "Sub-optimal swapchain",
14        // Error Codes //
15        VK_ERROR_OUT_OF_HOST_MEMORY => "A host memory allocation has failed",
16        VK_ERROR_OUT_OF_DEVICE_MEMORY => "A device memory allocation has failed",
17        VK_ERROR_INITIALIZATION_FAILED => {
18            "Initialization of an object could not be completed for implementation-specific reasons"
19        }
20        VK_ERROR_DEVICE_LOST => "The logical or physical device has been lost",
21        VK_ERROR_MEMORY_MAP_FAILED => "Mapping of a memory object has failed",
22        VK_ERROR_LAYER_NOT_PRESENT => "A requested layer is not presented or could not be loaded",
23        VK_ERROR_EXTENSION_NOT_PRESENT => "A requested extension is not supported",
24        VK_ERROR_FEATURE_NOT_PRESENT => "A requested feature is not supported",
25        VK_ERROR_INCOMPATIBLE_DRIVER => {
26            "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons"
27        }
28        VK_ERROR_TOO_MANY_OBJECTS => "Too many objects of the type have already been created",
29        VK_ERROR_FORMAT_NOT_SUPPORTED => "A requested format is not supported on this device",
30        VK_ERROR_FRAGMENTED_POOL => "A pool allocation has failed due to fragmentation of the pool's memory",
31        #[cfg(feature = "VK_KHR_surface")]
32        VK_ERROR_SURFACE_LOST_KHR => "Surface lost",
33        #[cfg(feature = "VK_KHR_surface")]
34        VK_ERROR_NATIVE_WINDOW_IN_USE_KHR => "Native window is in use",
35        #[cfg(feature = "VK_KHR_swapchain")]
36        VK_ERROR_OUT_OF_DATE_KHR => "Out of date",
37        #[cfg(feature = "VK_KHR_display_swapchain")]
38        VK_ERROR_INCOMPATIBLE_DISPLAY_KHR => {
39            "The display used by a swapchain does not use the same presentable image layout"
40        }
41        #[cfg(feature = "VK_EXT_debug_report")]
42        VK_ERROR_VALIDATION_FAILED_EXT => "Validation failed",
43        #[cfg(feature = "VK_NV_glsl_shader")]
44        VK_ERROR_INVALID_SHADER_NV => "Invalid GLSL shader",
45        #[cfg(feature = "VK_KHR_maintenance1")]
46        VK_ERROR_OUT_OF_POOL_MEMORY_KHR => "A pool memory allocation has failed",
47        #[cfg(feature = "VK_KHR_external_memory")]
48        VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR => "An external handle is not a valid handle of ths specified type",
49        #[cfg(feature = "VK_KHR_buffer_device_address")]
50        VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR => {
51            "A buffer creation or memory allocation failed because the requested address is not available"
52        }
53        #[cfg(feature = "VK_EXT_descriptor_indexing")]
54        VK_ERROR_FRAGMENTATION_EXT => "A descriptor pool creation has failed due to fragmentation",
55        _ => "Unknown or extension-specific error",
56    }
57}