-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add vulkan error checks in command_queue_execute_and_present #98883
Conversation
ERR_FAIL_COND_V(err == VK_ERROR_OUT_OF_HOST_MEMORY, FAILED); | ||
ERR_FAIL_COND_V(err == VK_ERROR_OUT_OF_DEVICE_MEMORY, FAILED); | ||
ERR_FAIL_COND_V(err == VK_ERROR_DEVICE_LOST, FAILED); | ||
ERR_FAIL_COND_V(err == VK_ERROR_SURFACE_LOST_KHR, FAILED); | ||
ERR_FAIL_COND_V(err == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT, FAILED); | ||
ERR_FAIL_COND_V(err != VK_SUCCESS && err != VK_SUBOPTIMAL_KHR, FAILED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking every condition it would be best to do the following:
- print a string using
ERR_FAIL_COND_V_MSG()
- Create a function that takes in a
VkResult
and returns a string. The implementation of the function can be hidden behind an#ifdef DEBUG
so that the full error handling is only done for debug builds. we use this pattern in a few places in the source (here for example:godot/drivers/gles3/storage/texture_storage.h
Line 706 in 87318a2
inline String TextureStorage::get_framebuffer_error(GLenum p_status) {
After adding this messaging and running it on my project. I found out that I'm getting a Anyway, I also noticed that
I'm just wondering if we should be doing the same thing after the call to |
I don't think so, that branch there is a special debug section to help us find out what was the last command in the command queue that ran before things crashed. In this case, we know the error came from |
It looks like this PR is failing on style checks. Here are our docs on our code style guidelines https://docs.godotengine.org/en/latest/contributing/development/code_style_guidelines.html#c-and-objective-c Once you make those changes you will need to squash your commits together, how to do that is described here: https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html#the-interactive-rebase |
Oh shoot, I assumed the PR would be squashed with the merge. Okay, I'll squash my commits. Thank you |
fix: add debug helper functoin and update messaging vulkan result
2b6acf5
to
ddf5c03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you for making such quick changes
Thanks for the quick reviews! |
Thanks! Congratulations on your first contribution! 🎉 |
This PR adds error checks for all possible errors that can arise from
vkQueuePresentKHR
Currently when
device_functions.QueuePresentKHR()
returns an error, the error message looks like this:According to the vulkan docs (here): vkQueuePresentKHR returns one of these error values:
Note: VK_ERROR_OUT_OF_DATE_KHR is already handled in command_queue_execute_and_present.
So the error has to be one of these:
Unfortunately there's no way to know which error it is from the editor.
This PR ensures that the error message includes the error type to allow for further troubleshooting.