OpenXR: Display error enum string in debug mode
Up until now, when encountering an OpenXR error / exception in debug mode, only the raw OpenXR error enum int value would be displayed, which wasn't really descriptive nor useful. To remedy this, this commit adds an `xrResultToString` call to additionally convert this value into its corresponding enum string. See PR for an example error print. Pull Request: https://projects.blender.org/blender/blender/pulls/142582
This commit is contained in:
@@ -252,9 +252,15 @@ void GHOST_XrContext::dispatchErrorMessage(const GHOST_XrException *exception) c
|
||||
error.user_message = exception->msg_.data();
|
||||
error.customdata = s_error_handler_customdata;
|
||||
|
||||
char error_string_buf[XR_MAX_RESULT_STRING_SIZE];
|
||||
xrResultToString(getInstance(), static_cast<XrResult>(exception->result_), error_string_buf);
|
||||
|
||||
if (isDebugMode()) {
|
||||
fprintf(
|
||||
stderr, "Error: \t%s\n\tOpenXR error value: %i\n", error.user_message, exception->result_);
|
||||
fprintf(stderr,
|
||||
"Error: \t%s\n\tOpenXR error: %s (error value: %i)\n",
|
||||
error.user_message,
|
||||
error_string_buf,
|
||||
exception->result_);
|
||||
}
|
||||
|
||||
/* Potentially destroys GHOST_XrContext */
|
||||
|
||||
Reference in New Issue
Block a user