Commit 5fa58efc authored by Jakob Bornecrantz's avatar Jakob Bornecrantz

st/oxr: Verify width and height on swapchain create

parent 4ebc308a
Pipeline #52720 passed with stages
in 1 minute and 8 seconds
......@@ -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) { \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment