comp: Return proper errors for OpenGL xrCreateSwapchain

This commit is contained in:
Christoph Haag 2021-01-25 14:50:36 +01:00 committed by Jakob Bornecrantz
parent cb352839e3
commit b64b6f75fe
3 changed files with 10 additions and 2 deletions
src/xrt
compositor/client
include/xrt
state_trackers/oxr

View file

@ -354,14 +354,14 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
U_LOG_E(
"Only one array layer is supported with OpenGL ES "
"2");
return XRT_ERROR_OPENGL;
return XRT_ERROR_SWAPCHAIN_FLAG_VALID_BUT_UNSUPPORTED;
}
}
int64_t vk_format = gl_format_to_vk(info->format);
if (vk_format == 0) {
U_LOG_E("Invalid format!");
return XRT_ERROR_VULKAN;
return XRT_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED;
}
struct xrt_swapchain_create_info xinfo = *info;

View file

@ -48,4 +48,9 @@ typedef enum xrt_result
* Multiple not supported on this layer level (IPC, compositor).
*/
XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED = -11,
/*!
* The requested format is not supported by Monado.
*/
XRT_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED = -12,
} xrt_result_t;

View file

@ -211,6 +211,9 @@ oxr_create_swapchain(struct oxr_logger *log,
return oxr_error(log, XR_ERROR_FEATURE_UNSUPPORTED,
"Specified swapchain creation flag is valid, "
"but not supported");
} else if (xret == XRT_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED) {
return oxr_error(log, XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED,
"Specified swapchain format is not supported");
}
if (xret != XRT_SUCCESS) {
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "Failed to create swapchain");