st/oxr: use correct verify error codes for gfx bindings check
CTS expects any/all invalid graphics bindings for xrCreateSession calls to return XR_ERROR_GRAPHICS_DEVICE_INVALID rather than XR_ERROR_INITIALIZATION_FAILED. Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2660>
588 unmodified linesExpand all5895905915925935935945955965975975985996006016016026036046056066066076086096106116116126136146156166166176186196206216225 unmodified lines62862963063163063263363463563616 unmodified lines65365465565665565765865966065966166266366466566466666766866967066967167267367467567367667767867968067868168268368468513 unmodified lines6997007017027007037047057067077057087097107117127137147117157167177187197204 unmodified lines7257267277287247297307317327287337347357367377387397357407417427437445 unmodified lines7507517527537497547557567577586 unmodified lines76576676776876476977077177277377477577677277777877978078178263 unmodified lines588 unmodified linesExpand allXrResultoxr_verify_XrGraphicsBindingOpenGLXlibKHR(struct oxr_logger *log, const XrGraphicsBindingOpenGLXlibKHR *next){ if (next->type != XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "Graphics binding has invalid type"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "Graphics binding has invalid type"); }
if (next->xDisplay == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "XrGraphicsBindingOpenGLXlibKHR::xDisplay is NULL"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingOpenGLXlibKHR::xDisplay is NULL"); }
if (next->glxContext == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingOpenGLXlibKHR::glxContext is NULL"); }
if (next->glxDrawable == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingOpenGLXlibKHR::glxDrawable is NULL"); }
if (next->glxFBConfig == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingOpenGLXlibKHR::glxFBConfig is NULL"); }
if (next->visualid == 0) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "XrGraphicsBindingOpenGLXlibKHR::visualid is 0"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingOpenGLXlibKHR::visualid is 0"); }
return XR_SUCCESS;}5 unmodified linesXrResultoxr_verify_XrGraphicsBindingOpenGLWin32KHR(struct oxr_logger *log, const XrGraphicsBindingOpenGLWin32KHR *next){ if (next->type != XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "Graphics binding has invalid type"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "Graphics binding has invalid type"); }
if (next->hDC == NULL) { return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "hDC is NULL");16 unmodified lines{ /* XR_TYPE_GRAPHICS_BINDING_VULKAN2_KHR aliased to * XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR */ if (next->type != XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "Graphics binding has invalid type"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "Graphics binding has invalid type"); }
if (next->instance == VK_NULL_HANDLE) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingVulkanKHR(2)::instance is invalid"); }
if (next->physicalDevice == VK_NULL_HANDLE) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingVulkanKHR(2)::physicalDevice is invalid"); }
if (next->device == VK_NULL_HANDLE) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "XrGraphicsBindingVulkanKHR(2)::device is invalid"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingVulkanKHR(2)::device is invalid"); }
if (next->queueFamilyIndex == VK_QUEUE_FAMILY_IGNORED) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingVulkanKHR(2)::queueFamilyIndex is invalid"); }
if (next->queueIndex == UINT32_MAX) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingVulkanKHR(2)::queueIndex is invalid"); }
return XR_SUCCESS;13 unmodified lines next->type); }
if (next->getProcAddress == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingEGLMNDX::getProcAddress cannot be NULL"); }
if (next->display == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "XrGraphicsBindingEGLMNDX::display cannot be NULL"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingEGLMNDX::display cannot be NULL"); }
// The next->config field can be NULL if EGL_KHR_no_config_context is supported by the display.
if (next->context == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "XrGraphicsBindingEGLMNDX::context cannot be NULL"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingEGLMNDX::context cannot be NULL"); }
return XR_SUCCESS;}4 unmodified linesXrResultoxr_verify_XrGraphicsBindingOpenGLESAndroidKHR(struct oxr_logger *log, const XrGraphicsBindingOpenGLESAndroidKHR *next){ if (next->type != XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "Graphics binding has invalid type"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "Graphics binding has invalid type"); }
if (next->display == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingOpenGLESAndroidKHR::display cannot be NULL"); }
// The next->config field can be NULL if EGL_KHR_no_config_context is supported by the display.
if (next->context == NULL) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingOpenGLESAndroidKHR::context cannot be NULL"); }
return XR_SUCCESS;5 unmodified linesXrResultoxr_verify_XrGraphicsBindingD3D11KHR(struct oxr_logger *log, const XrGraphicsBindingD3D11KHR *next){ if (next->type != XR_TYPE_GRAPHICS_BINDING_D3D11_KHR) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "Graphics binding has invalid type"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "Graphics binding has invalid type"); } if (next->device == NULL) { return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingD3D11KHR::device cannot be NULL");6 unmodified linesXrResultoxr_verify_XrGraphicsBindingD3D12KHR(struct oxr_logger *log, const XrGraphicsBindingD3D12KHR *next){ if (next->type != XR_TYPE_GRAPHICS_BINDING_D3D12_KHR) { return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "Graphics binding has invalid type"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "Graphics binding has invalid type"); } if (next->device == NULL) { return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingD3D12KHR::device cannot be NULL"); } if (next->queue == NULL) { // not specified in spec nor cts, so assume it's this return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, "XrGraphicsBindingD3D12KHR::queue cannot be NULL"); return oxr_error(log, XR_ERROR_GRAPHICS_DEVICE_INVALID, "XrGraphicsBindingD3D12KHR::queue cannot be NULL"); } return XR_SUCCESS;}#endif // defined(XR_USE_GRAPHICS_API_D3D12)63 unmodified lines