Skip to content

Add a VK::toError function to simplify vulkan error handling.#1085

Open
manon-traverse wants to merge 1 commit intollvm:mainfrom
Traverse-Research:vk-to-error
Open

Add a VK::toError function to simplify vulkan error handling.#1085
manon-traverse wants to merge 1 commit intollvm:mainfrom
Traverse-Research:vk-to-error

Conversation

@manon-traverse
Copy link
Copy Markdown
Contributor

Error handling on Vulkan was a bit manual and verbose, with random error codes being assigned. This PR simplifies this using a VK::toError function (similar to the HR::toError function). This way, we preserve the original VkResult in the error message and don't have arbitrarily chosen error codes.

Comment on lines +23 to +24
return llvm::createStringError("%s (VkResult = %d)", Msg.data(),
static_cast<int>(Result));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much more effort it is to stringify the error codes (or at least a few common ones), and/or to translate a few common ones to std::error_code. HR::toError()` seems to do it but not sure if that yields any advantage or if anything "relies" on it...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HR::toError just stores it as an integer under std::system_category. The only thing in practice is that the error number is logged. This kind of does the same thing.

Copy link
Copy Markdown
Contributor

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants