Vulkan command return code, Vulkan error code collection, Vulkan error code detailed explanation

While the core Vulkan API is not designed to catch incorrect usage cases, some cases still require return codes. Commands in Vulkan return their status via return codes, which fall into one of two categories:

  • When a command needs to convey success or status information. All successful completion codes are non-negative.

  • When a command needs to communicate failures that can only be detected at runtime. All runtime error codes are negative.

All return codes in Vulkan are reported via the VkResult return value. Possible codes are:

// Provided by VK_VERSION_1_0
typedef enum VkResult {
    VK_SUCCESS = 0,
    VK_NOT_READY = 1,
    VK_TIMEOUT = 2,
    VK_EVENT_SET = 3,
    VK_EVENT_RESET = 4,
    VK_INCOMPLETE = 5,
    VK_ERROR_OUT_OF_HOST_MEMORY = -1,
    VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
    VK_ERROR_INITIALIZATION_FAILED = -3,
    VK_ERROR_DEVICE_LOST = -4,
    VK_ERROR_MEMORY_MAP_FAILED = -5,
    VK_ERROR_LAYER_NOT_PRESENT = -6,
    VK_ERROR_EXTENSION_NOT_PRESENT = -7,
    VK_ERROR_FEATURE_NOT_PRESENT = -8,
    VK_ERROR_INCOMPATIBLE_DRIVER = -9,
    VK_ERROR_TOO_MANY_OBJECTS = -10,
    VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
    VK_ERROR_FRAGMENTED_POOL = -12,
    VK_ERROR_UNKNOWN = -13,
  // Provided by VK_VERSION_1_1
    VK_ERROR_OUT_OF_POOL_MEMORY = -1000069000,
  // Provided by VK_VERSION_1_1
    VK_ERROR_INVALID_EXTERNAL_HANDLE = -1000072003,
  // Provided by VK_VERSION_1_2
    VK_ERROR_FRAGMENTATION = -1000161000,
  // Provided by VK_VERSION_1_2
    VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS = -1000257000,
  // Provided by VK_VERSION_1_3
    VK_PIPELINE_COMPILE_REQUIRED = 1000297000,
  // Provided by VK_KHR_surface
    VK_ERROR_SURFACE_LOST_KHR = -1000000000,
  // Provided by VK_KHR_surface
    VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
  // Provided by VK_KHR_swapchain
    VK_SUBOPTIMAL_KHR = 1000001003,
  // Provided by VK_KHR_swapchain
    VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
  // Provided by VK_KHR_display_swapchain
    VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
  // Provided by VK_EXT_debug_report
    VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
  // Provided by VK_NV_glsl_shader
    VK_ERROR_INVALID_SHADER_NV = -1000012000,
  // Provided by VK_KHR_video_queue
    VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR = -1000023000,
  // Provided by VK_KHR_video_queue
    VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR = -1000023001,
  // Provided by VK_KHR_video_queue
    VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR = -1000023002,
  // Provided by VK_KHR_video_queue
    VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR = -1000023003,
  // Provided by VK_KHR_video_queue
    VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR = -1000023004,
  // Provided by VK_KHR_video_queue
    VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR = -1000023005,
  // Provided by VK_EXT_image_drm_format_modifier
    VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT = -1000158000,
  // Provided by VK_KHR_global_priority
    VK_ERROR_NOT_PERMITTED_KHR = -1000174001,
  // Provided by VK_EXT_full_screen_exclusive
    VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT = -1000255000,
  // Provided by VK_KHR_deferred_host_operations
    VK_THREAD_IDLE_KHR = 1000268000,
  // Provided by VK_KHR_deferred_host_operations
    VK_THREAD_DONE_KHR = 1000268001,
  // Provided by VK_KHR_deferred_host_operations
    VK_OPERATION_DEFERRED_KHR = 1000268002,
  // Provided by VK_KHR_deferred_host_operations
    VK_OPERATION_NOT_DEFERRED_KHR = 1000268003,
#ifdef VK_ENABLE_BETA_EXTENSIONS
  // Provided by VK_KHR_video_encode_queue
    VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR = -1000299000,
#endif
  // Provided by VK_EXT_image_compression_control
    VK_ERROR_COMPRESSION_EXHAUSTED_EXT = -1000338000,
  // Provided by VK_EXT_shader_object
    VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT = 1000482000,
  // Provided by VK_KHR_maintenance1
    VK_ERROR_OUT_OF_POOL_MEMORY_KHR = VK_ERROR_OUT_OF_POOL_MEMORY,
  // Provided by VK_KHR_external_memory
    VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = VK_ERROR_INVALID_EXTERNAL_HANDLE,
  // Provided by VK_EXT_descriptor_indexing
    VK_ERROR_FRAGMENTATION_EXT = VK_ERROR_FRAGMENTATION,
  // Provided by VK_EXT_global_priority
    VK_ERROR_NOT_PERMITTED_EXT = VK_ERROR_NOT_PERMITTED_KHR,
  // Provided by VK_EXT_buffer_device_address
    VK_ERROR_INVALID_DEVICE_ADDRESS_EXT = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS,
  // Provided by VK_KHR_buffer_device_address
    VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS,
  // Provided by VK_EXT_pipeline_creation_cache_control
    VK_PIPELINE_COMPILE_REQUIRED_EXT = VK_PIPELINE_COMPILE_REQUIRED,
  // Provided by VK_EXT_pipeline_creation_cache_control
    VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT = VK_PIPELINE_COMPILE_REQUIRED,
} VkResult;

 

describe

success code
  • VK_SUCCESScommand completed successfully

  • VK_NOT_READYFence or query not yet complete

  • VK_TIMEOUTThe wait operation has not been within the specified time

  • VK_EVENT_SETsignal an event

  • VK_EVENT_RESETevent not signaled

  • VK_INCOMPLETEThe returned array is too small for the result

  • VK_SUBOPTIMAL_KHRIt is no longer a property that the swap chain matches the surface exactly, but can still be used to render to the surface successfully.

  • VK_THREAD_IDLE_KHRThe deferred operation is not complete, but this thread currently has no work to do at the time of this call.

  • VK_THREAD_DONE_KHRThe deferred operation did not complete, but there was no remaining work to distribute to other threads.

  • VK_OPERATION_DEFERRED_KHRThe operation was requested to be deferred, and at least some work was deferred.

  • VK_OPERATION_NOT_DEFERRED_KHRA deferred operation was requested and no operation was deferred.

  • VK_PIPELINE_COMPILE_REQUIREDThe requested pipeline creation would require compilation, but the application requests compilation to not be performed.

error code
  • VK_ERROR_OUT_OF_HOST_MEMORYHost memory allocation failed.

  • VK_ERROR_OUT_OF_DEVICE_MEMORYDevice memory allocation has failed.

  • VK_ERROR_INITIALIZATION_FAILEDAn object's initialization can be incomplete for implementation-specific reasons.

  • VK_ERROR_DEVICE_LOSTA logical or physical device has been lost. View lost devices

  • VK_ERROR_MEMORY_MAP_FAILEDThe mapping of the memory object failed.

  • VK_ERROR_LAYER_NOT_PRESENTThe requested layer does not exist or could not be loaded.

  • VK_ERROR_EXTENSION_NOT_PRESENTThe requested extension is not supported.

  • VK_ERROR_FEATURE_NOT_PRESENTThe requested feature is not supported.

  • VK_ERROR_INCOMPATIBLE_DRIVERThe requested Vulkan version is either not supported by the driver or is an implementation-specific cause.

  • VK_ERROR_TOO_MANY_OBJECTSToo many objects of this type have been created.

  • VK_ERROR_FORMAT_NOT_SUPPORTEDThe requested format is not supported on this device.

  • VK_ERROR_FRAGMENTED_POOLPool allocation failed due to pool memory fragmentation. This information must be returned only if no host or device allocation was attempted and memory was created to accommodate the new allocation. This should be returned in preference, but only if the implementation determines that the pool allocation failure was due to fragmentation.VK_ERROR_OUT_OF_POOL_MEMORY

  • VK_ERROR_SURFACE_LOST_KHRSurfaces are no longer available.

  • VK_ERROR_NATIVE_WINDOW_IN_USE_KHRThe requested window already exists and is prevented from being used again by Vulkan or other APIs.

  • VK_ERROR_OUT_OF_DATE_KHRThe surface has changed such that it is no longer compatible with the swap chain, and further renders requests using the swap chain will fail. Applications must query the new surface properties and recreate their swap chain if they wish to continue presenting to the surface.

  • VK_ERROR_INCOMPATIBLE_DISPLAY_KHRThe displays used by the swap chain do not use the same renderable image layout, or are in a way that prevents images from being shared.

  • VK_ERROR_INVALID_SHADER_NVOne or more shaders failed to compile or link. If enabled, more details will be reported back to the application.VK_EXT_debug_report

  • VK_ERROR_OUT_OF_POOL_MEMORYPool memory allocation failed. This information must be returned only if no host or device allocation was attempted and memory was created to accommodate the new allocation. If the failure is definitely due to pool fragmentation , it should be returned instead.VK_ERROR_FRAGMENTED_POOL

  • VK_ERROR_INVALID_EXTERNAL_HANDLEInvalid external handle for the specified type of handle.

  • VK_ERROR_FRAGMENTATIONDescriptor pool creation failed due to fragmentation.

  • VK_ERROR_INVALID_DEVICE_ADDRESS_EXTBuffer creation failed because the requested address is not available.

  • VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESSBuffer creation or memory allocation failed because the requested address is not available. Shader group handle allocation failed because the requested shader group handle information is no longer valid.

  • VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXTNo exclusive full-screen access to swapchains that failed at creation. This may occur for implementation-dependent reasons in  the application's controls.VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT

  • VK_ERROR_COMPRESSION_EXHAUSTED_EXTImage creation failed because internal resources required for compression have been exhausted. This value must only be returned when a fixed-rate compression is requested .

  • VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHRThe requested  VkImageUsageFlags  are not supported.

  • VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHRThe requested video image layout is not supported.

  • VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHRThe video profile does not support  the operation specified via VkVideoProfileInfoKHR ::.videoCodecOperation

  • VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHRThe setting parameter format is not supported in the requested  VkVideoProfileInfoKHR  chain.

  • VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR Parameters in the VkVideoProfileInfoKHR chain specific to codec requests  are not supported.

  • VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHRThe specified video does not support the standard header version.

  • VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHRThe specified video standard parameter does not conform to the syntactic or semantic requirements of the used video compression standard or the value derived from the parameter does not comply with the rules defined by the used video compression standard or implementation.

  • VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXTThe provided binary shader code is not compatible with this device.

  • VK_ERROR_UNKNOWNAn unknown error occurred; either the application supplied invalid input, or an implementation failure occurred.

If the command returns a runtime error, any output arguments will have undefined content unless otherwise specified, and unless the output argument is a structure with and fields, those fields will not be modified. Any linked structures will also have undefined content, among other things, and will not be modified.sTypepNextpNextsTypepNext

VK_ERROR_OUT_OF_*_MEMORYErrors will not modify any currently existing Vulcan objects. Objects that have been successfully created can still be used by the application.

Notice

As a general rule, the , , and commands may not return, while any other with a return code may return it. For these commands, any exceptions to this rule are described.FreeReleaseResetVK_ERROR_OUT_OF_HOST_MEMORY

VK_ERROR_UNKNOWNWill be returned by the implementation when an unexpected error occurs, not attributable to the application and implementation. Under these conditions, it can be returned from any  command that returns a VkResult  .

Notice

VK_ERROR_UNKNOWNExpected to never return, if the application behavior is valid and the implementation is error-free. If received, the application should be checked against the latest authentication layer to verify that correct behavior is possible. If no issues are found, there may be an implementation issue and the implementer should be contacted for support.VK_ERROR_UNKNOWN

Performance-critical commands typically have no return codes. If a runtime error occurs in such a command, the implementation will delay reporting the error until the specified point. For commands that log to commandbuffer() runtime errors are reported by.vkCmd*vkEndCommandBuffer

Documentation comments

For more information, see  the Vulkan specification

This page is excerpted from the Vulkan specification. Fixes and changes should be made to the specification, not directly.

Guess you like

Origin blog.csdn.net/a2831942318/article/details/129928762