mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
st/oxr: Verify width and height on swapchain create
This commit is contained in:
parent
4ebc308a37
commit
5fa58efcbf
|
@ -59,10 +59,9 @@ oxr_xrCreateSwapchain(XrSession session,
|
|||
OXR_VERIFY_ARG_NOT_NULL(&log, out_swapchain);
|
||||
|
||||
// Save people from shooting themselves in the foot.
|
||||
if (createInfo->arraySize <= 0) {
|
||||
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
|
||||
"(createInfo->arraySize) must be non-zero");
|
||||
}
|
||||
OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->arraySize);
|
||||
OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->width);
|
||||
OXR_VERIFY_ARG_NOT_ZERO(&log, createInfo->height);
|
||||
|
||||
ret = sess->create_swapchain(&log, sess, createInfo, &sc);
|
||||
if (ret != XR_SUCCESS) {
|
||||
|
|
|
@ -91,6 +91,14 @@ extern "C" {
|
|||
} \
|
||||
} while (false)
|
||||
|
||||
#define OXR_VERIFY_ARG_NOT_ZERO(log, arg) \
|
||||
do { \
|
||||
if (arg == 0) { \
|
||||
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
|
||||
"(" #arg " == 0) must be non-zero"); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
#define OXR_VERIFY_ARG_TYPE_AND_NULL(log, arg, type_enum) \
|
||||
do { \
|
||||
if (arg == NULL) { \
|
||||
|
|
Loading…
Reference in a new issue