st/oxr: Verify max swapchain size

This commit is contained in:
Jiali Zhang 2023-09-26 20:12:50 +08:00 committed by Jakob Bornecrantz
parent bbb1de1b0f
commit 900c43a6e2

View file

@ -63,6 +63,19 @@ oxr_xrCreateSwapchain(XrSession session, const XrSwapchainCreateInfo *createInfo
OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->width);
OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->height);
const uint32_t max_dims = sess->compositor->info.max_tetxure_size;
if (max_dims != 0) {
if (createInfo->width > max_dims) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE, "(createInfo->width > %u) width too large",
max_dims);
}
if (createInfo->height > max_dims) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
"(createInfo->height > %u) height too large", max_dims);
}
}
if (createInfo->faceCount != 1 && createInfo->faceCount != 6) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE, "faceCount must be 1 or 6");
}