mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-03 12:28:07 +00:00
st/oxr: Ignore graphics bindings from disabled extensions
This commit is contained in:
parent
3c9eafc1f0
commit
c8515e142d
src/xrt/state_trackers/oxr
|
@ -89,10 +89,18 @@ oxr_instance_create(struct oxr_logger *log,
|
||||||
inst->timekeeping = time_state_create();
|
inst->timekeeping = time_state_create();
|
||||||
|
|
||||||
inst->headless = false;
|
inst->headless = false;
|
||||||
|
inst->opengl_enable = false;
|
||||||
|
inst->vulkan_enable = false;
|
||||||
for (uint32_t i = 0; i < createInfo->enabledExtensionCount; ++i) {
|
for (uint32_t i = 0; i < createInfo->enabledExtensionCount; ++i) {
|
||||||
if (strcmp(createInfo->enabledExtensionNames[i],
|
if (strcmp(createInfo->enabledExtensionNames[i],
|
||||||
XR_KHR_HEADLESS_EXTENSION_NAME) == 0) {
|
XR_KHR_HEADLESS_EXTENSION_NAME) == 0) {
|
||||||
inst->headless = true;
|
inst->headless = true;
|
||||||
|
} else if (strcmp(createInfo->enabledExtensionNames[i],
|
||||||
|
XR_KHR_OPENGL_ENABLE_EXTENSION_NAME) == 0) {
|
||||||
|
inst->opengl_enable = true;
|
||||||
|
} else if (strcmp(createInfo->enabledExtensionNames[i],
|
||||||
|
XR_KHR_VULKAN_ENABLE_EXTENSION_NAME) == 0) {
|
||||||
|
inst->vulkan_enable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -429,10 +429,10 @@ struct oxr_instance
|
||||||
uint64_t debug;
|
uint64_t debug;
|
||||||
struct xrt_prober *prober;
|
struct xrt_prober *prober;
|
||||||
|
|
||||||
/*!
|
// Enabled extensions
|
||||||
* Whether headless sessions can be created
|
|
||||||
*/
|
|
||||||
bool headless;
|
bool headless;
|
||||||
|
bool opengl_enable;
|
||||||
|
bool vulkan_enable;
|
||||||
|
|
||||||
// Hardcoded single system.
|
// Hardcoded single system.
|
||||||
struct oxr_system system;
|
struct oxr_system system;
|
||||||
|
|
|
@ -92,12 +92,24 @@ oxr_verify_XrSessionCreateInfo(struct oxr_logger* log,
|
||||||
XrStructureType* next_type = (XrStructureType*)createInfo->next;
|
XrStructureType* next_type = (XrStructureType*)createInfo->next;
|
||||||
#ifdef XR_USE_PLATFORM_XLIB
|
#ifdef XR_USE_PLATFORM_XLIB
|
||||||
if (*next_type == XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR) {
|
if (*next_type == XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR) {
|
||||||
|
if (!inst->opengl_enable) {
|
||||||
|
return oxr_error(
|
||||||
|
log, XR_ERROR_VALIDATION_FAILURE,
|
||||||
|
"OpenGL "
|
||||||
|
"requires " XR_KHR_OPENGL_ENABLE_EXTENSION_NAME);
|
||||||
|
}
|
||||||
return oxr_verify_XrGraphicsBindingOpenGLXlibKHR(
|
return oxr_verify_XrGraphicsBindingOpenGLXlibKHR(
|
||||||
log, (XrGraphicsBindingOpenGLXlibKHR*)createInfo->next);
|
log, (XrGraphicsBindingOpenGLXlibKHR*)createInfo->next);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||||
if (*next_type == XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR) {
|
if (*next_type == XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR) {
|
||||||
|
if (!inst->vulkan_enable) {
|
||||||
|
return oxr_error(
|
||||||
|
log, XR_ERROR_VALIDATION_FAILURE,
|
||||||
|
"Vulkan "
|
||||||
|
"requires " XR_KHR_VULKAN_ENABLE_EXTENSION_NAME);
|
||||||
|
}
|
||||||
return oxr_verify_XrGraphicsBindingVulkanKHR(
|
return oxr_verify_XrGraphicsBindingVulkanKHR(
|
||||||
log, (XrGraphicsBindingVulkanKHR*)createInfo->next);
|
log, (XrGraphicsBindingVulkanKHR*)createInfo->next);
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in a new issue