st/oxr: Verify frameEndInfo->layerCount

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2262>
This commit is contained in:
Christoph Haag 2024-06-27 00:43:59 +02:00
parent 6307f17726
commit 8f59821336

View file

@ -176,6 +176,21 @@ oxr_xrEndFrame(XrSession session, const XrFrameEndInfo *frameEndInfo)
OXR_VERIFY_SESSION_RUNNING(&log, sess);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, frameEndInfo, XR_TYPE_FRAME_END_INFO);
// Get from compositor.
struct xrt_system_compositor_info *info = sess->sys->xsysc ? &sess->sys->xsysc->info : NULL;
// headless extension does not modify the 16 layer minimum.
uint32_t max_layers = 16;
if (info) {
max_layers = info->max_layers;
}
if (frameEndInfo->layerCount > max_layers) {
return oxr_error(&log, XR_ERROR_LAYER_LIMIT_EXCEEDED, "(layerCount == %u) exceeds limit %u",
frameEndInfo->layerCount, max_layers);
}
#ifdef XRT_FEATURE_RENDERDOC
if (sess->sys->inst->rdoc_api) {
#ifndef XR_USE_PLATFORM_ANDROID