vk/error: Handle ERROR_OUT_OF_DATE_WSI
This commit is contained in:
+44
-38
@@ -88,52 +88,58 @@ __vk_errorf(VkResult error, const char *file, int line, const char *format, ...)
|
||||
va_list ap;
|
||||
char buffer[256];
|
||||
|
||||
static const char *error_names[] = {
|
||||
"VK_ERROR_UNKNOWN",
|
||||
"VK_ERROR_UNAVAILABLE",
|
||||
"VK_ERROR_INITIALIZATION_FAILED",
|
||||
"VK_ERROR_OUT_OF_HOST_MEMORY",
|
||||
"VK_ERROR_OUT_OF_DEVICE_MEMORY",
|
||||
"VK_ERROR_DEVICE_ALREADY_CREATED",
|
||||
"VK_ERROR_DEVICE_LOST",
|
||||
"VK_ERROR_INVALID_POINTER",
|
||||
"VK_ERROR_INVALID_VALUE",
|
||||
"VK_ERROR_INVALID_HANDLE",
|
||||
"VK_ERROR_INVALID_ORDINAL",
|
||||
"VK_ERROR_INVALID_MEMORY_SIZE",
|
||||
"VK_ERROR_INVALID_EXTENSION",
|
||||
"VK_ERROR_INVALID_FLAGS",
|
||||
"VK_ERROR_INVALID_ALIGNMENT",
|
||||
"VK_ERROR_INVALID_FORMAT",
|
||||
"VK_ERROR_INVALID_IMAGE",
|
||||
"VK_ERROR_INVALID_DESCRIPTOR_SET_DATA",
|
||||
"VK_ERROR_INVALID_QUEUE_TYPE",
|
||||
"VK_ERROR_UNSUPPORTED_SHADER_IL_VERSION",
|
||||
"VK_ERROR_BAD_SHADER_CODE",
|
||||
"VK_ERROR_BAD_PIPELINE_DATA",
|
||||
"VK_ERROR_NOT_MAPPABLE",
|
||||
"VK_ERROR_MEMORY_MAP_FAILED",
|
||||
"VK_ERROR_MEMORY_UNMAP_FAILED",
|
||||
"VK_ERROR_INCOMPATIBLE_DEVICE",
|
||||
"VK_ERROR_INCOMPATIBLE_DRIVER",
|
||||
"VK_ERROR_INCOMPLETE_COMMAND_BUFFER",
|
||||
"VK_ERROR_BUILDING_COMMAND_BUFFER",
|
||||
"VK_ERROR_MEMORY_NOT_BOUND",
|
||||
"VK_ERROR_INCOMPATIBLE_QUEUE",
|
||||
"VK_ERROR_INVALID_LAYER",
|
||||
};
|
||||
#define ERROR_CASE(error) case error: error_str = #error; break;
|
||||
|
||||
assert(error <= VK_ERROR_UNKNOWN && error >= VK_ERROR_INVALID_LAYER);
|
||||
const char *error_str;
|
||||
switch ((int32_t)error) {
|
||||
ERROR_CASE(VK_ERROR_UNKNOWN)
|
||||
ERROR_CASE(VK_ERROR_UNAVAILABLE)
|
||||
ERROR_CASE(VK_ERROR_INITIALIZATION_FAILED)
|
||||
ERROR_CASE(VK_ERROR_OUT_OF_HOST_MEMORY)
|
||||
ERROR_CASE(VK_ERROR_OUT_OF_DEVICE_MEMORY)
|
||||
ERROR_CASE(VK_ERROR_DEVICE_ALREADY_CREATED)
|
||||
ERROR_CASE(VK_ERROR_DEVICE_LOST)
|
||||
ERROR_CASE(VK_ERROR_INVALID_POINTER)
|
||||
ERROR_CASE(VK_ERROR_INVALID_VALUE)
|
||||
ERROR_CASE(VK_ERROR_INVALID_HANDLE)
|
||||
ERROR_CASE(VK_ERROR_INVALID_ORDINAL)
|
||||
ERROR_CASE(VK_ERROR_INVALID_MEMORY_SIZE)
|
||||
ERROR_CASE(VK_ERROR_INVALID_EXTENSION)
|
||||
ERROR_CASE(VK_ERROR_INVALID_FLAGS)
|
||||
ERROR_CASE(VK_ERROR_INVALID_ALIGNMENT)
|
||||
ERROR_CASE(VK_ERROR_INVALID_FORMAT)
|
||||
ERROR_CASE(VK_ERROR_INVALID_IMAGE)
|
||||
ERROR_CASE(VK_ERROR_INVALID_DESCRIPTOR_SET_DATA)
|
||||
ERROR_CASE(VK_ERROR_INVALID_QUEUE_TYPE)
|
||||
ERROR_CASE(VK_ERROR_UNSUPPORTED_SHADER_IL_VERSION)
|
||||
ERROR_CASE(VK_ERROR_BAD_SHADER_CODE)
|
||||
ERROR_CASE(VK_ERROR_BAD_PIPELINE_DATA)
|
||||
ERROR_CASE(VK_ERROR_NOT_MAPPABLE)
|
||||
ERROR_CASE(VK_ERROR_MEMORY_MAP_FAILED)
|
||||
ERROR_CASE(VK_ERROR_MEMORY_UNMAP_FAILED)
|
||||
ERROR_CASE(VK_ERROR_INCOMPATIBLE_DEVICE)
|
||||
ERROR_CASE(VK_ERROR_INCOMPATIBLE_DRIVER)
|
||||
ERROR_CASE(VK_ERROR_INCOMPLETE_COMMAND_BUFFER)
|
||||
ERROR_CASE(VK_ERROR_BUILDING_COMMAND_BUFFER)
|
||||
ERROR_CASE(VK_ERROR_MEMORY_NOT_BOUND)
|
||||
ERROR_CASE(VK_ERROR_INCOMPATIBLE_QUEUE)
|
||||
ERROR_CASE(VK_ERROR_INVALID_LAYER)
|
||||
ERROR_CASE(VK_ERROR_OUT_OF_DATE_WSI)
|
||||
default:
|
||||
assert(!"Unknown error");
|
||||
error_str = "unknown error";
|
||||
}
|
||||
|
||||
#undef ERROR_CASE
|
||||
|
||||
if (format) {
|
||||
va_start(ap, format);
|
||||
vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "%s:%d: %s (%s)\n", file, line,
|
||||
buffer, error_names[-error - 1]);
|
||||
fprintf(stderr, "%s:%d: %s (%s)\n", file, line, buffer, error_str);
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d: %s\n", file, line, error_names[-error - 1]);
|
||||
fprintf(stderr, "%s:%d: %s\n", file, line, error_str);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
||||
@@ -189,7 +189,7 @@ x11_acquire_next_image(struct anv_swap_chain *anv_chain,
|
||||
if (geom->width != chain->extent.width ||
|
||||
geom->height != chain->extent.height) {
|
||||
free(geom);
|
||||
return VK_ERROR_OUT_OF_DATE_WSI;
|
||||
return vk_error(VK_ERROR_OUT_OF_DATE_WSI);
|
||||
}
|
||||
free(geom);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user