From a36753443a110067018e57bd3a2d102acdcf78dd Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 31 May 2020 16:49:25 +0100 Subject: [PATCH] st/oxr: Make all oxr_error calls uniform and improve output --- doc/changes/state_trackers/mr.359.17.md | 2 + src/xrt/state_trackers/oxr/oxr_api_action.c | 12 +-- src/xrt/state_trackers/oxr/oxr_api_session.c | 6 +- .../state_trackers/oxr/oxr_api_swapchain.c | 7 +- src/xrt/state_trackers/oxr/oxr_api_verify.h | 11 +-- src/xrt/state_trackers/oxr/oxr_binding.c | 8 +- src/xrt/state_trackers/oxr/oxr_event.c | 2 +- src/xrt/state_trackers/oxr/oxr_handle_base.c | 6 +- src/xrt/state_trackers/oxr/oxr_logger.c | 73 +++++++++++++++---- src/xrt/state_trackers/oxr/oxr_session.c | 29 ++++---- src/xrt/state_trackers/oxr/oxr_session_egl.c | 13 ++-- src/xrt/state_trackers/oxr/oxr_session_gl.c | 4 +- src/xrt/state_trackers/oxr/oxr_session_vk.c | 4 +- src/xrt/state_trackers/oxr/oxr_space.c | 6 +- src/xrt/state_trackers/oxr/oxr_swapchain.c | 16 ++-- src/xrt/state_trackers/oxr/oxr_swapchain_gl.c | 4 +- src/xrt/state_trackers/oxr/oxr_system.c | 8 +- src/xrt/state_trackers/oxr/oxr_verify.c | 6 +- src/xrt/state_trackers/oxr/oxr_vulkan.c | 26 ++++--- 19 files changed, 148 insertions(+), 95 deletions(-) create mode 100644 doc/changes/state_trackers/mr.359.17.md diff --git a/doc/changes/state_trackers/mr.359.17.md b/doc/changes/state_trackers/mr.359.17.md new file mode 100644 index 000000000..25511cb3f --- /dev/null +++ b/doc/changes/state_trackers/mr.359.17.md @@ -0,0 +1,2 @@ +OpenXR: Rework the logging formatting of error messages, this makes it easier to +read for the application developer. diff --git a/src/xrt/state_trackers/oxr/oxr_api_action.c b/src/xrt/state_trackers/oxr/oxr_api_action.c index 7a69e27c5..fc060b9b0 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_action.c +++ b/src/xrt/state_trackers/oxr/oxr_api_action.c @@ -366,7 +366,7 @@ oxr_xrGetActionStateBoolean(XrSession session, if (act->action_type != XR_ACTION_TYPE_BOOLEAN_INPUT) { return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, - " not created with boolean type"); + "Not created with boolean type"); } ret = oxr_verify_subaction_path_get( @@ -399,7 +399,7 @@ oxr_xrGetActionStateFloat(XrSession session, if (act->action_type != XR_ACTION_TYPE_FLOAT_INPUT) { return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, - " not created with float type"); + "Not created with float type"); } ret = oxr_verify_subaction_path_get( @@ -432,7 +432,7 @@ oxr_xrGetActionStateVector2f(XrSession session, if (act->action_type != XR_ACTION_TYPE_VECTOR2F_INPUT) { return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, - " not created with float[2] type"); + "Not created with float[2] type"); } ret = oxr_verify_subaction_path_get( @@ -464,7 +464,7 @@ oxr_xrGetActionStatePose(XrSession session, if (act->action_type != XR_ACTION_TYPE_POSE_INPUT) { return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, - " not created with pose type"); + "Not created with pose type"); } ret = oxr_verify_subaction_path_get( @@ -540,7 +540,7 @@ oxr_xrApplyHapticFeedback(XrSession session, if (act->action_type != XR_ACTION_TYPE_VIBRATION_OUTPUT) { return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, - " not created with output vibration type"); + "Not created with output vibration type"); } return oxr_action_apply_haptic_feedback(&log, sess, act->key, sub_paths, @@ -571,7 +571,7 @@ oxr_xrStopHapticFeedback(XrSession session, if (act->action_type != XR_ACTION_TYPE_VIBRATION_OUTPUT) { return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, - " not created with output vibration type"); + "Not created with output vibration type"); } return oxr_action_stop_haptic_feedback(&log, sess, act->key, sub_paths); diff --git a/src/xrt/state_trackers/oxr/oxr_api_session.c b/src/xrt/state_trackers/oxr/oxr_api_session.c index d86004395..3413e689d 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_session.c +++ b/src/xrt/state_trackers/oxr/oxr_api_session.c @@ -200,7 +200,7 @@ oxr_xrGetVisibilityMaskKHR(XrSession session, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrGetVisibilityMaskKHR"); - return oxr_error(&log, XR_ERROR_HANDLE_INVALID, " not implemented"); + return oxr_error(&log, XR_ERROR_HANDLE_INVALID, "Not implemented"); } #endif @@ -224,7 +224,7 @@ oxr_xrPerfSettingsSetPerformanceLevelEXT(XrSession session, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrPerfSettingsSetPerformanceLevelEXT"); - return oxr_error(&log, XR_ERROR_HANDLE_INVALID, " not implemented"); + return oxr_error(&log, XR_ERROR_HANDLE_INVALID, "Not implemented"); } #endif @@ -251,7 +251,7 @@ oxr_xrThermalGetTemperatureTrendEXT( OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrThermalGetTemperatureTrendEXT"); - return oxr_error(&log, XR_ERROR_HANDLE_INVALID, " not implemented"); + return oxr_error(&log, XR_ERROR_HANDLE_INVALID, "Not implemented"); } #endif diff --git a/src/xrt/state_trackers/oxr/oxr_api_swapchain.c b/src/xrt/state_trackers/oxr/oxr_api_swapchain.c index 74052f477..7f4777035 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_swapchain.c +++ b/src/xrt/state_trackers/oxr/oxr_api_swapchain.c @@ -50,9 +50,8 @@ oxr_xrCreateSwapchain(XrSession session, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrCreateSwapchain"); if (sess->compositor == NULL) { - return oxr_error( - &log, XR_ERROR_VALIDATION_FAILURE, - "xrCreateSwapchain is illegal in headless sessions"); + return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE, + "Is illegal in headless sessions"); } OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, createInfo, XR_TYPE_SWAPCHAIN_CREATE_INFO); @@ -104,7 +103,7 @@ oxr_xrEnumerateSwapchainImages(XrSwapchain swapchain, } if (imageCapacityInput < xsc->num_images) { return oxr_error(&log, XR_ERROR_SIZE_INSUFFICIENT, - "(imageCapacityInput = %u)", + "(imageCapacityInput == %u)", imageCapacityInput); } diff --git a/src/xrt/state_trackers/oxr/oxr_api_verify.h b/src/xrt/state_trackers/oxr/oxr_api_verify.h index 758703c74..5969b48ed 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_verify.h +++ b/src/xrt/state_trackers/oxr/oxr_api_verify.h @@ -30,10 +30,10 @@ extern "C" { } \ if (new_thing->handle.state != OXR_HANDLE_STATE_LIVE) { \ return oxr_error(log, XR_ERROR_HANDLE_INVALID, \ - " state == %s (" #thing " == %p)", \ + "(" #thing " == %p) state == %s", \ + (void *)new_thing, \ oxr_handle_state_to_string( \ - new_thing->handle.state), \ - (void *)new_thing); \ + new_thing->handle.state)); \ } \ oxr_log_set_instance(log, lookup); \ } while (0) @@ -91,7 +91,7 @@ extern "C" { do { \ if (!(inst)->extensions.mixed_case_name) { \ return oxr_error((log), XR_ERROR_FUNCTION_UNSUPPORTED, \ - " Requires XR_" #mixed_case_name \ + "Requires XR_" #mixed_case_name \ " extension enabled"); \ } \ } while (false) @@ -133,7 +133,8 @@ extern "C" { do { \ if (count > 0 && paths == NULL) { \ return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \ - " " #count " is not zero but " #paths \ + "(" #count \ + ") is not zero but " #paths \ " is NULL"); \ } \ } while (false) diff --git a/src/xrt/state_trackers/oxr/oxr_binding.c b/src/xrt/state_trackers/oxr/oxr_binding.c index 52dafe6cf..9cb63dbfd 100644 --- a/src/xrt/state_trackers/oxr/oxr_binding.c +++ b/src/xrt/state_trackers/oxr/oxr_binding.c @@ -417,7 +417,7 @@ oxr_action_get_current_interaction_profile( if (!sess->actionsAttached) { return oxr_error(log, XR_ERROR_ACTIONSET_NOT_ATTACHED, - " xrAttachSessionActionSets has not been " + "xrAttachSessionActionSets has not been " "called on this session."); } @@ -431,7 +431,7 @@ oxr_action_get_current_interaction_profile( interactionProfile->interactionProfile = sess->gamepad; } else { return oxr_error(log, XR_ERROR_HANDLE_INVALID, - " not implemented"); + "Not implemented"); } return XR_SUCCESS; } @@ -446,7 +446,7 @@ oxr_action_get_input_source_localized_name( char *buffer) { //! @todo Implement - return oxr_error(log, XR_ERROR_HANDLE_INVALID, " not implemented"); + return oxr_error(log, XR_ERROR_HANDLE_INVALID, "Not implemented"); } XrResult @@ -458,5 +458,5 @@ oxr_action_enumerate_bound_sources(struct oxr_logger *log, XrPath *sources) { //! @todo Implement - return oxr_error(log, XR_ERROR_HANDLE_INVALID, " not implemented"); + return oxr_error(log, XR_ERROR_HANDLE_INVALID, "Not implemented"); } diff --git a/src/xrt/state_trackers/oxr/oxr_event.c b/src/xrt/state_trackers/oxr/oxr_event.c index 85f6efbb8..a616a13b5 100644 --- a/src/xrt/state_trackers/oxr/oxr_event.c +++ b/src/xrt/state_trackers/oxr/oxr_event.c @@ -110,7 +110,7 @@ oxr_event_alloc(struct oxr_logger *log, if (event == NULL) { return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " out of memory"); + "Out of memory"); } event->next = NULL; diff --git a/src/xrt/state_trackers/oxr/oxr_handle_base.c b/src/xrt/state_trackers/oxr/oxr_handle_base.c index 30906e87c..ff1fbc0d1 100644 --- a/src/xrt/state_trackers/oxr/oxr_handle_base.c +++ b/src/xrt/state_trackers/oxr/oxr_handle_base.c @@ -74,7 +74,7 @@ oxr_handle_init(struct oxr_logger *log, if (parent->state != OXR_HANDLE_STATE_LIVE) { return oxr_error( log, XR_ERROR_RUNTIME_FAILURE, - " Handle %p given parent %p in invalid state: %s", + "Handle %p given parent %p in invalid state: %s", (void *)parent, (void *)hb, oxr_handle_state_to_string(parent->state)); } @@ -93,7 +93,7 @@ oxr_handle_init(struct oxr_logger *log, } if (!placed) { return oxr_error(log, XR_ERROR_LIMIT_REACHED, - " parent handle has no more room for " + "Parent handle has no more room for " "child handles"); } } @@ -167,7 +167,7 @@ oxr_handle_do_destroy(struct oxr_logger *log, if (!found) { return oxr_error( log, XR_ERROR_RUNTIME_FAILURE, - " parent handle does not refer to this handle"); + "Parent handle does not refer to this handle"); } /* clear parent pointer */ diff --git a/src/xrt/state_trackers/oxr/oxr_logger.c b/src/xrt/state_trackers/oxr/oxr_logger.c index ae56958a9..3e4cef483 100644 --- a/src/xrt/state_trackers/oxr/oxr_logger.c +++ b/src/xrt/state_trackers/oxr/oxr_logger.c @@ -23,9 +23,65 @@ DEBUG_GET_ONCE_BOOL_OPTION(entrypoints, "OXR_DEBUG_ENTRYPOINTS", false) DEBUG_GET_ONCE_BOOL_OPTION(break_on_error, "OXR_BREAK_ON_ERROR", false) + +/* + * + * Helpers + * + */ + static const char * oxr_result_to_string(XrResult result); +static bool +is_fmt_func_arg_start(const char *fmt) +{ + if (fmt == NULL) { + return false; + } + if (fmt[0] == '(') { + return true; + } + return false; +} + +/*! + * Prints the first part of a logging message, has three forms. + * + * ```c++ + * print_prefix(l, "(myInfo->foo) is bad", "XR_ERROR_VALIDATION_FAILURE"); + * // XR_ERROR_VALIDATION_FAILURE: xrMyFunc(myInfo->foo) is bad + * + * print_prefix(l, "This is bad", "XR_ERROR_VALIDATION_FAILURE"); + * // XR_ERROR_VALIDATION_FAILURE in xrMyFunc: This is bad + * + * print_prefix(l, "No functions set now", "LOG"); + * // LOG: No function set now + * ``` + */ +static void +print_prefix(struct oxr_logger *logger, const char *fmt, const char *prefix) +{ + if (logger->api_func_name != NULL) { + if (is_fmt_func_arg_start(fmt)) { + fprintf(stderr, "%s: %s", prefix, + logger->api_func_name); + } else { + fprintf(stderr, "%s in %s: ", prefix, + logger->api_func_name); + } + } else { + fprintf(stderr, "%s: ", prefix); + } +} + + +/* + * + * 'Exported' functions. + * + */ + void oxr_log_init(struct oxr_logger *logger, const char *api_func_name) { @@ -46,9 +102,7 @@ oxr_log_set_instance(struct oxr_logger *logger, struct oxr_instance *inst) void oxr_log(struct oxr_logger *logger, const char *fmt, ...) { - if (logger->api_func_name != NULL) { - fprintf(stderr, " in %s", logger->api_func_name); - } + print_prefix(logger, fmt, "LOG"); va_list args; va_start(args, fmt); @@ -61,11 +115,7 @@ oxr_log(struct oxr_logger *logger, const char *fmt, ...) void oxr_warn(struct oxr_logger *logger, const char *fmt, ...) { - if (logger->api_func_name != NULL) { - fprintf(stderr, "%s WARNING: ", logger->api_func_name); - } else { - fprintf(stderr, "WARNING: "); - } + print_prefix(logger, fmt, "WARNING"); va_list args; va_start(args, fmt); @@ -82,13 +132,8 @@ oxr_error(struct oxr_logger *logger, XrResult result, const char *fmt, ...) fprintf(stderr, "\t"); } - fprintf(stderr, "%s", oxr_result_to_string(result)); + print_prefix(logger, fmt, oxr_result_to_string(result)); - if (logger->api_func_name != NULL) { - fprintf(stderr, " in %s", logger->api_func_name); - } - - fprintf(stderr, ": "); va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); diff --git a/src/xrt/state_trackers/oxr/oxr_session.c b/src/xrt/state_trackers/oxr/oxr_session.c index f81c237b3..5dc2a6be3 100644 --- a/src/xrt/state_trackers/oxr/oxr_session.c +++ b/src/xrt/state_trackers/oxr/oxr_session.c @@ -91,7 +91,7 @@ oxr_session_enumerate_formats(struct oxr_logger *log, struct xrt_compositor *xc = sess->compositor; if (formatCountOutput == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, - "(formatCountOutput)"); + "(formatCountOutput == NULL) can not be null"); } if (xc == NULL) { if (formatCountOutput != NULL) { @@ -112,7 +112,7 @@ oxr_session_begin(struct oxr_logger *log, { if (is_running(sess)) { return oxr_error(log, XR_ERROR_SESSION_RUNNING, - " session is already running"); + "Session is already running"); } struct xrt_compositor *xc = sess->compositor; @@ -125,7 +125,9 @@ oxr_session_begin(struct oxr_logger *log, * system right now */ return oxr_error( log, XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED, - " view configuration type not supported"); + "(beginInfo->primaryViewConfigurationType == " + "0x%08x) view configuration type not supported", + view_type); } xrt_comp_begin_session(xc, (enum xrt_view_type)beginInfo @@ -144,11 +146,11 @@ oxr_session_end(struct oxr_logger *log, struct oxr_session *sess) if (!is_running(sess)) { return oxr_error(log, XR_ERROR_SESSION_NOT_RUNNING, - " session is not running"); + "Session is not running"); } if (sess->state != XR_SESSION_STATE_STOPPING) { return oxr_error(log, XR_ERROR_SESSION_NOT_STOPPING, - " session is not stopping"); + "Session is not stopping"); } if (xc != NULL) { @@ -177,7 +179,7 @@ oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess) { if (!is_running(sess)) { return oxr_error(log, XR_ERROR_SESSION_NOT_RUNNING, - " session is not running"); + "Session is not running"); } if (sess->state == XR_SESSION_STATE_FOCUSED) { @@ -399,7 +401,7 @@ oxr_session_frame_wait(struct oxr_logger *log, { if (!is_running(sess)) { return oxr_error(log, XR_ERROR_SESSION_NOT_RUNNING, - " session is not running"); + "Session is not running"); } //! @todo this should be carefully synchronized, because there may be @@ -420,7 +422,7 @@ oxr_session_frame_wait(struct oxr_logger *log, if ((int64_t)predicted_display_time <= 0) { return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " got a negative display time '%" PRIi64 "'", + "Got a negative display time '%" PRIi64 "'", (int64_t)predicted_display_time); } @@ -432,7 +434,7 @@ oxr_session_frame_wait(struct oxr_logger *log, if (frameState->predictedDisplayTime <= 0) { return oxr_error( log, XR_ERROR_RUNTIME_FAILURE, - " time_state_monotonic_to_ts_ns returned '%" PRIi64 "'", + "Time_state_monotonic_to_ts_ns returned '%" PRIi64 "'", frameState->predictedDisplayTime); } @@ -452,7 +454,7 @@ oxr_session_frame_begin(struct oxr_logger *log, struct oxr_session *sess) { if (!is_running(sess)) { return oxr_error(log, XR_ERROR_SESSION_NOT_RUNNING, - " session is not running"); + "Session is not running"); } struct xrt_compositor *xc = sess->compositor; @@ -786,11 +788,11 @@ oxr_session_frame_end(struct oxr_logger *log, if (!is_running(sess)) { return oxr_error(log, XR_ERROR_SESSION_NOT_RUNNING, - " session is not running"); + "Session is not running"); } if (!sess->frame_started) { return oxr_error(log, XR_ERROR_CALL_ORDER_INVALID, - " frame not begun with xrBeginFrame"); + "Frame not begun with xrBeginFrame"); } if (frameEndInfo->displayTime <= 0) { @@ -1034,7 +1036,8 @@ oxr_session_create_impl(struct oxr_logger *log, return XR_SUCCESS; } return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, - "(createInfo->next->type)"); + "(createInfo->next->type) doesn't contain a valid " + "graphics binding structs"); } XrResult diff --git a/src/xrt/state_trackers/oxr/oxr_session_egl.c b/src/xrt/state_trackers/oxr/oxr_session_egl.c index 60b80bc8b..908274e68 100644 --- a/src/xrt/state_trackers/oxr/oxr_session_egl.c +++ b/src/xrt/state_trackers/oxr/oxr_session_egl.c @@ -47,21 +47,22 @@ oxr_session_populate_egl(struct oxr_logger *log, PFNEGLQUERYCONTEXTPROC eglQueryContext = (PFNEGLQUERYCONTEXTPROC)next->getProcAddress("eglQueryContext"); if (!eglQueryContext) { - return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - "getProcAddress(eglQueryContext) failed"); + return oxr_error( + log, XR_ERROR_INITIALIZATION_FAILED, + "Call to getProcAddress(eglQueryContext) failed"); } if (!eglQueryContext(next->display, next->context, EGL_CONTEXT_CLIENT_TYPE, &egl_client_type)) { return oxr_error( log, XR_ERROR_INITIALIZATION_FAILED, - "eglQueryContext(EGL_CONTEXT_CLIENT_TYPE) failed"); + "Call to eglQueryContext(EGL_CONTEXT_CLIENT_TYPE) failed"); } if (egl_client_type != EGL_OPENGL_API && egl_client_type != EGL_OPENGL_ES_API) { return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - "unsupported EGL client type"); + "Unsupported EGL client type"); } struct xrt_compositor_fd *xcfd = NULL; @@ -69,7 +70,7 @@ oxr_session_populate_egl(struct oxr_logger *log, true, &xcfd); if (ret < 0 || xcfd == NULL) { return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - " failed create a fd compositor '%i'", ret); + "Failed create a fd compositor '%i'", ret); } struct xrt_compositor_gl *xcgl = @@ -79,7 +80,7 @@ oxr_session_populate_egl(struct oxr_logger *log, if (xcgl == NULL) { xcfd->base.destroy(&xcfd->base); return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - " failed create a egl client compositor"); + "Failed create a egl client compositor"); } sess->compositor = &xcgl->base; diff --git a/src/xrt/state_trackers/oxr/oxr_session_gl.c b/src/xrt/state_trackers/oxr/oxr_session_gl.c index 8c4546cdf..3bd6b6bb3 100644 --- a/src/xrt/state_trackers/oxr/oxr_session_gl.c +++ b/src/xrt/state_trackers/oxr/oxr_session_gl.c @@ -38,7 +38,7 @@ oxr_session_populate_gl_xlib(struct oxr_logger *log, true, &xcfd); if (ret < 0 || xcfd == NULL) { return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - " failed create a fd compositor '%i'", ret); + "Failed create a fd compositor '%i'", ret); } @@ -49,7 +49,7 @@ oxr_session_populate_gl_xlib(struct oxr_logger *log, if (xcgl == NULL) { xcfd->base.destroy(&xcfd->base); return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - " failed create a xlib client compositor"); + "Failed create a xlib client compositor"); } sess->compositor = &xcgl->base; diff --git a/src/xrt/state_trackers/oxr/oxr_session_vk.c b/src/xrt/state_trackers/oxr/oxr_session_vk.c index ce03db2fe..9d9882164 100644 --- a/src/xrt/state_trackers/oxr/oxr_session_vk.c +++ b/src/xrt/state_trackers/oxr/oxr_session_vk.c @@ -32,7 +32,7 @@ oxr_session_populate_vk(struct oxr_logger *log, false, &xcfd); if (ret < 0 || xcfd == NULL) { return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - " failed create a fd compositor '%i'", ret); + "Failed create a fd compositor '%i'", ret); } struct xrt_compositor_vk *xcvk = xrt_gfx_vk_provider_create( @@ -42,7 +42,7 @@ oxr_session_populate_vk(struct oxr_logger *log, if (xcvk == NULL) { xcfd->base.destroy(&xcfd->base); return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - " failed create a vk client compositor"); + "Failed create a vk client compositor"); } sess->compositor = &xcvk->base; diff --git a/src/xrt/state_trackers/oxr/oxr_space.c b/src/xrt/state_trackers/oxr/oxr_space.c index 8ac47360d..290282f70 100644 --- a/src/xrt/state_trackers/oxr/oxr_space.c +++ b/src/xrt/state_trackers/oxr/oxr_space.c @@ -37,8 +37,8 @@ check_reference_space_type(struct oxr_logger *log, XrReferenceSpaceType type) #endif default: return oxr_error(log, XR_ERROR_REFERENCE_SPACE_UNSUPPORTED, - "(createInfo->referenceSpaceType = " - ")"); + "(createInfo->referenceSpaceType == 0x%08x)", + type); } } @@ -222,7 +222,7 @@ oxr_space_action_relation(struct oxr_logger *log, // Internal error check. if (act_spc == NULL || act_spc->is_reference || ref_spc == NULL || !ref_spc->is_reference) { - return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "this is bad!"); + return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "This is bad!"); } // Reset so no relation is returned. diff --git a/src/xrt/state_trackers/oxr/oxr_swapchain.c b/src/xrt/state_trackers/oxr/oxr_swapchain.c index 7277f0634..fdde2a0b6 100644 --- a/src/xrt/state_trackers/oxr/oxr_swapchain.c +++ b/src/xrt/state_trackers/oxr/oxr_swapchain.c @@ -28,7 +28,7 @@ oxr_swapchain_acquire_image(struct oxr_logger *log, uint32_t index; if (sc->acquired.num >= sc->swapchain->num_images) { return oxr_error(log, XR_ERROR_CALL_ORDER_INVALID, - " all images have been acquired"); + "All images have been acquired"); } if (sc->is_static && (sc->released.yes || sc->waited.yes)) { @@ -39,7 +39,7 @@ oxr_swapchain_acquire_image(struct oxr_logger *log, struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; if (!xsc->acquire_image(xsc, &index)) { return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " call to xsc->acquire_image failed"); + "Call to xsc->acquire_image failed"); } if (sc->images[index].state != OXR_IMAGE_STATE_READY) { @@ -72,12 +72,12 @@ oxr_swapchain_wait_image(struct oxr_logger *log, if (sc->waited.yes) { return oxr_error( log, XR_ERROR_CALL_ORDER_INVALID, - " swapchain has already been waited, call release"); + "Swapchain has already been waited, call release"); } if (u_index_fifo_is_empty(&sc->acquired.fifo)) { return oxr_error(log, XR_ERROR_CALL_ORDER_INVALID, - " no image acquired"); + "No image acquired"); } uint32_t index; @@ -86,7 +86,7 @@ oxr_swapchain_wait_image(struct oxr_logger *log, struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; if (!xsc->wait_image(xsc, waitInfo->timeout, index)) { return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " call to xsc->wait_image failed"); + "Call to xsc->wait_image failed"); } // The app can only wait on one image. @@ -104,7 +104,7 @@ oxr_swapchain_release_image(struct oxr_logger *log, { if (!sc->waited.yes) { return oxr_error(log, XR_ERROR_CALL_ORDER_INVALID, - " no swapchain images waited on"); + "No swapchain images waited on"); } sc->waited.yes = false; @@ -113,7 +113,7 @@ oxr_swapchain_release_image(struct oxr_logger *log, struct xrt_swapchain *xsc = (struct xrt_swapchain *)sc->swapchain; if (!xsc->release_image(xsc, index)) { return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " call to xsc->release_image failed"); + "Call to xsc->release_image failed"); } // Only decerement here. @@ -192,7 +192,7 @@ oxr_create_swapchain(struct oxr_logger *log, if (xsc == NULL) { return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " failed to create swapchain"); + "Failed to create swapchain"); } struct oxr_swapchain *sc = NULL; diff --git a/src/xrt/state_trackers/oxr/oxr_swapchain_gl.c b/src/xrt/state_trackers/oxr/oxr_swapchain_gl.c index 8a97f52dc..324002cea 100644 --- a/src/xrt/state_trackers/oxr/oxr_swapchain_gl.c +++ b/src/xrt/state_trackers/oxr/oxr_swapchain_gl.c @@ -63,7 +63,7 @@ oxr_swapchain_gl_enumerate_images(struct oxr_logger *log, break; default: return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, - "unsupported XrSwapchainImageBaseHeader type"); + "Unsupported XrSwapchainImageBaseHeader type"); } for (uint32_t i = 0; i < count; i++) { @@ -71,7 +71,7 @@ oxr_swapchain_gl_enumerate_images(struct oxr_logger *log, (gles_imgs != NULL && gles_imgs[i].type != images[0].type)) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, - "images array contains mixed types"); + "Images array contains mixed types"); } if (gl_imgs != NULL) { gl_imgs[i].image = xsc->images[i]; diff --git a/src/xrt/state_trackers/oxr/oxr_system.c b/src/xrt/state_trackers/oxr/oxr_system.c index cc0fc863a..465316809 100644 --- a/src/xrt/state_trackers/oxr/oxr_system.c +++ b/src/xrt/state_trackers/oxr/oxr_system.c @@ -79,7 +79,7 @@ oxr_system_verify_id(struct oxr_logger *log, { if (systemId != 1) { return oxr_error(log, XR_ERROR_SYSTEM_INVALID, - "invalid system %" PRIu64, systemId); + "Invalid system %" PRIu64, systemId); } return XR_SUCCESS; } @@ -124,7 +124,7 @@ oxr_system_fill_in(struct oxr_logger *log, if (head == NULL) { return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED, - " failed to probe device"); + "Failed to probe device"); } if (head->tracking_origin->type == XRT_TRACKING_TYPE_NONE) { @@ -266,7 +266,7 @@ oxr_system_get_view_conf_properties( if (viewConfigurationType != sys->view_config_type) { return oxr_error(log, XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED, - "invalid view configuration type"); + "Invalid view configuration type"); } // clang-format off @@ -303,7 +303,7 @@ oxr_system_enumerate_view_conf_views( if (viewConfigurationType != sys->view_config_type) { return oxr_error(log, XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED, - "invalid view configuration type"); + "Invalid view configuration type"); } OXR_TWO_CALL_FILL_IN_HELPER(log, viewCapacityInput, viewCountOutput, diff --git a/src/xrt/state_trackers/oxr/oxr_verify.c b/src/xrt/state_trackers/oxr/oxr_verify.c index 712c9a254..253a1f7a4 100644 --- a/src/xrt/state_trackers/oxr/oxr_verify.c +++ b/src/xrt/state_trackers/oxr/oxr_verify.c @@ -466,7 +466,7 @@ oxr_verify_XrSessionCreateInfo(struct oxr_logger *log, if (createInfo->createFlags != 0) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, - " Non-zero session create flags"); + "Non-zero session create flags"); } XrResult result = oxr_system_verify_id(log, inst, createInfo->systemId); @@ -568,7 +568,7 @@ oxr_verify_XrGraphicsBindingVulkanKHR(struct oxr_logger *log, { if (next->type != XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, - " Graphics binding has invalid type"); + "Graphics binding has invalid type"); } return XR_SUCCESS; @@ -585,7 +585,7 @@ oxr_verify_XrGraphicsBindingEGLMNDX(struct oxr_logger *log, { if (next->type != XR_TYPE_GRAPHICS_BINDING_EGL_MNDX) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, - " Graphics binding has invalid type"); + "Graphics binding has invalid type"); } return XR_SUCCESS; diff --git a/src/xrt/state_trackers/oxr/oxr_vulkan.c b/src/xrt/state_trackers/oxr/oxr_vulkan.c index 9d5e4921b..f2d456a36 100644 --- a/src/xrt/state_trackers/oxr/oxr_vulkan.c +++ b/src/xrt/state_trackers/oxr/oxr_vulkan.c @@ -83,29 +83,31 @@ oxr_vk_get_physical_device(struct oxr_logger *log, vk_ret = vkEnumeratePhysicalDevices(vkInstance, &count, NULL); if (vk_ret != VK_SUCCESS) { - return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " vkEnumeratePhysicalDevices returned %u", - vk_ret); + return oxr_error( + log, XR_ERROR_RUNTIME_FAILURE, + "Call to vkEnumeratePhysicalDevices returned %u", vk_ret); } if (count == 0) { - return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " vkEnumeratePhysicalDevices returned zero " - "VkPhysicalDevices"); + return oxr_error( + log, XR_ERROR_RUNTIME_FAILURE, + "Call to vkEnumeratePhysicalDevices returned zero " + "VkPhysicalDevices"); } VkPhysicalDevice *phys = U_TYPED_ARRAY_CALLOC(VkPhysicalDevice, count); vk_ret = vkEnumeratePhysicalDevices(vkInstance, &count, phys); if (vk_ret != VK_SUCCESS) { free(phys); - return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " vkEnumeratePhysicalDevices returned %u", - vk_ret); + return oxr_error( + log, XR_ERROR_RUNTIME_FAILURE, + "Call to vkEnumeratePhysicalDevices returned %u", vk_ret); } if (count == 0) { free(phys); - return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, - " vkEnumeratePhysicalDevices returned zero " - "VkPhysicalDevices"); + return oxr_error( + log, XR_ERROR_RUNTIME_FAILURE, + "Call to vkEnumeratePhysicalDevices returned zero " + "VkPhysicalDevices"); } if (count > 1) {