Commit 927ea225 by Charlie Lao Committed by Commit Bot

Vulkan: add vulkan error code in the error message

If driver returns error code that we do not know, we simply output "unknown vulkan error code". Instead we should at least include the actual errorCode here so that people can search up to see what it is. Also remove the double period at the end of string and added a few other vulkan error strings. Bug: b/154665382 Change-Id: Ic4138e90534b4e7d97520fe10ac1477d2930d9c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2160130 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent b5992a55
......@@ -3654,7 +3654,8 @@ void ContextVk::handleError(VkResult errorCode,
GLenum glErrorCode = DefaultGLErrorCode(errorCode);
std::stringstream errorStream;
errorStream << "Internal Vulkan error: " << VulkanResultString(errorCode) << ".";
errorStream << "Internal Vulkan error (" << errorCode << "): " << VulkanResultString(errorCode)
<< ".";
if (errorCode == VK_ERROR_DEVICE_LOST)
{
......
......@@ -251,8 +251,8 @@ void DisplayVk::handleError(VkResult result,
ASSERT(result != VK_SUCCESS);
std::stringstream errorStream;
errorStream << "Internal Vulkan error: " << VulkanResultString(result) << ", in " << file
<< ", " << function << ":" << line << ".";
errorStream << "Internal Vulkan error (" << result << "): " << VulkanResultString(result)
<< ", in " << file << ", " << function << ":" << line << ".";
mStoredErrorString = errorStream.str();
if (result == VK_ERROR_DEVICE_LOST)
......
......@@ -185,61 +185,67 @@ const char *VulkanResultString(VkResult result)
switch (result)
{
case VK_SUCCESS:
return "Command successfully completed.";
return "Command successfully completed";
case VK_NOT_READY:
return "A fence or query has not yet completed.";
return "A fence or query has not yet completed";
case VK_TIMEOUT:
return "A wait operation has not completed in the specified time.";
return "A wait operation has not completed in the specified time";
case VK_EVENT_SET:
return "An event is signaled.";
return "An event is signaled";
case VK_EVENT_RESET:
return "An event is unsignaled.";
return "An event is unsignaled";
case VK_INCOMPLETE:
return "A return array was too small for the result.";
return "A return array was too small for the result";
case VK_SUBOPTIMAL_KHR:
return "A swapchain no longer matches the surface properties exactly, but can still be "
"used to present to the surface successfully.";
"used to present to the surface successfully";
case VK_ERROR_OUT_OF_HOST_MEMORY:
return "A host memory allocation has failed.";
return "A host memory allocation has failed";
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
return "A device memory allocation has failed.";
return "A device memory allocation has failed";
case VK_ERROR_INITIALIZATION_FAILED:
return "Initialization of an object could not be completed for implementation-specific "
"reasons.";
"reasons";
case VK_ERROR_DEVICE_LOST:
return "The logical or physical device has been lost.";
return "The logical or physical device has been lost";
case VK_ERROR_MEMORY_MAP_FAILED:
return "Mapping of a memory object has failed.";
return "Mapping of a memory object has failed";
case VK_ERROR_LAYER_NOT_PRESENT:
return "A requested layer is not present or could not be loaded.";
return "A requested layer is not present or could not be loaded";
case VK_ERROR_EXTENSION_NOT_PRESENT:
return "A requested extension is not supported.";
return "A requested extension is not supported";
case VK_ERROR_FEATURE_NOT_PRESENT:
return "A requested feature is not supported.";
return "A requested feature is not supported";
case VK_ERROR_INCOMPATIBLE_DRIVER:
return "The requested version of Vulkan is not supported by the driver or is otherwise "
"incompatible for implementation-specific reasons.";
"incompatible for implementation-specific reasons";
case VK_ERROR_TOO_MANY_OBJECTS:
return "Too many objects of the type have already been created.";
return "Too many objects of the type have already been created";
case VK_ERROR_FORMAT_NOT_SUPPORTED:
return "A requested format is not supported on this device.";
return "A requested format is not supported on this device";
case VK_ERROR_SURFACE_LOST_KHR:
return "A surface is no longer available.";
return "A surface is no longer available";
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
return "The requested window is already connected to a VkSurfaceKHR, or to some other "
"non-Vulkan API.";
"non-Vulkan API";
case VK_ERROR_OUT_OF_DATE_KHR:
return "A surface has changed in such a way that it is no longer compatible with the "
"swapchain.";
"swapchain";
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
return "The display used by a swapchain does not use the same presentable image "
"layout, or is incompatible in a way that prevents sharing an image.";
"layout, or is incompatible in a way that prevents sharing an image";
case VK_ERROR_VALIDATION_FAILED_EXT:
return "The validation layers detected invalid API usage.";
return "The validation layers detected invalid API usage";
case VK_ERROR_INVALID_SHADER_NV:
return "Invalid Vulkan shader was generated.";
return "Invalid Vulkan shader was generated";
case VK_ERROR_OUT_OF_POOL_MEMORY:
return "A pool memory allocation has failed";
case VK_ERROR_FRAGMENTED_POOL:
return "A pool allocation has failed due to fragmentation of the pool’s memory";
case VK_ERROR_INVALID_EXTERNAL_HANDLE:
return "An external handle is not a valid handle of the specified type";
default:
return "Unknown vulkan error code.";
return "Unknown vulkan error code";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment