mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 02:26:16 +00:00
xrt: add support for OpenGL ES
This commit advertises the extension and adds support for xrGetOpenGLESGraphicsRequirementsKHR
This commit is contained in:
parent
b358e22fd7
commit
5eacb6f309
|
@ -13,6 +13,7 @@ EXTENSIONS = (
|
|||
['XR_EXT_debug_utils'],
|
||||
['XR_KHR_convert_timespec_time', 'XR_USE_TIMESPEC'],
|
||||
['XR_KHR_opengl_enable', 'XR_USE_GRAPHICS_API_OPENGL'],
|
||||
['XR_KHR_opengl_es_enable', 'XR_USE_GRAPHICS_API_OPENGL_ES'],
|
||||
['XR_KHR_vulkan_enable', 'XR_USE_GRAPHICS_API_VULKAN'],
|
||||
['XR_MND_egl_enable', 'XR_USE_PLATFORM_EGL'],
|
||||
['XR_MND_headless'],
|
||||
|
|
|
@ -29,6 +29,7 @@ set(GL_SOURCE_FILES
|
|||
main/comp_documentation.h
|
||||
main/comp_glue_egl.c
|
||||
main/comp_glue_gl.c
|
||||
main/comp_glue_gles.c
|
||||
main/comp_glue_vk.c
|
||||
main/comp_glue_xlib.c
|
||||
main/comp_renderer.c
|
||||
|
|
22
src/xrt/compositor/main/comp_glue_gles.c
Normal file
22
src/xrt/compositor/main/comp_glue_gles.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2019, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Glue code to OpenGL ES client side glue code.
|
||||
* @author Simon Ser <contact@emersion.fr>
|
||||
* @ingroup comp
|
||||
*/
|
||||
|
||||
#include "xrt/xrt_gfx_gles.h"
|
||||
|
||||
|
||||
void
|
||||
xrt_gfx_gles_get_versions(struct xrt_api_requirements *ver)
|
||||
{
|
||||
ver->min_major = 2;
|
||||
ver->min_minor = 0;
|
||||
ver->min_patch = 0;
|
||||
ver->max_major = 3;
|
||||
ver->max_minor = 2;
|
||||
ver->max_patch = 1024 - 1;
|
||||
}
|
|
@ -24,6 +24,7 @@ compositor_srcs = [
|
|||
'main/comp_documentation.h',
|
||||
'main/comp_glue_egl.c',
|
||||
'main/comp_glue_gl.c',
|
||||
'main/comp_glue_gles.c',
|
||||
'main/comp_glue_vk.c',
|
||||
'main/comp_glue_xlib.c',
|
||||
'main/comp_renderer.c',
|
||||
|
|
28
src/xrt/include/xrt/xrt_gfx_gles.h
Normal file
28
src/xrt/include/xrt/xrt_gfx_gles.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2019, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Header for misc OpenGL ES code, not a complete graphics provider.
|
||||
* @author Simon Ser <contact@emersion.fr>
|
||||
* @ingroup xrt_iface
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "xrt/xrt_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* @ingroup xrt_iface
|
||||
*/
|
||||
void
|
||||
xrt_gfx_gles_get_versions(struct xrt_api_requirements *ver);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
// Move these to the build system instead.
|
||||
#define XR_USE_GRAPHICS_API_OPENGL
|
||||
#define XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
#define XR_USE_GRAPHICS_API_VULKAN
|
||||
#define XR_USE_PLATFORM_XLIB
|
||||
#define XR_USE_PLATFORM_EGL
|
||||
|
|
|
@ -177,6 +177,15 @@ oxr_xrGetOpenGLGraphicsRequirementsKHR(
|
|||
XrGraphicsRequirementsOpenGLKHR *graphicsRequirements);
|
||||
#endif
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
//! OpenXR API function @ep{xrGetOpenGLESGraphicsRequirementsKHR}
|
||||
XrResult
|
||||
oxr_xrGetOpenGLESGraphicsRequirementsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsOpenGLESKHR *graphicsRequirements);
|
||||
#endif
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
//! OpenXR API function @ep{xrGetVulkanInstanceExtensionsKHR}
|
||||
XrResult
|
||||
|
|
|
@ -240,6 +240,11 @@ handle_non_null(struct oxr_instance *inst,
|
|||
ENTRY_IF_EXT(xrGetOpenGLGraphicsRequirementsKHR, KHR_opengl_enable);
|
||||
#endif // OXR_HAVE_KHR_opengl_enable
|
||||
|
||||
#ifdef OXR_HAVE_KHR_opengl_es_enable
|
||||
ENTRY_IF_EXT(xrGetOpenGLESGraphicsRequirementsKHR,
|
||||
KHR_opengl_es_enable);
|
||||
#endif // OXR_HAVE_KHR_opengl_es_enable
|
||||
|
||||
#ifdef OXR_HAVE_KHR_vulkan_enable
|
||||
ENTRY_IF_EXT(xrGetVulkanInstanceExtensionsKHR, KHR_vulkan_enable);
|
||||
ENTRY_IF_EXT(xrGetVulkanDeviceExtensionsKHR, KHR_vulkan_enable);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "xrt/xrt_compiler.h"
|
||||
#include "xrt/xrt_gfx_gl.h"
|
||||
#include "xrt/xrt_gfx_gles.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
|
@ -160,6 +161,44 @@ oxr_xrEnumerateViewConfigurationViews(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* OpenGL ES
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
|
||||
XrResult
|
||||
oxr_xrGetOpenGLESGraphicsRequirementsKHR(
|
||||
XrInstance instance,
|
||||
XrSystemId systemId,
|
||||
XrGraphicsRequirementsOpenGLESKHR *graphicsRequirements)
|
||||
{
|
||||
struct oxr_instance *inst;
|
||||
struct oxr_logger log;
|
||||
OXR_VERIFY_INSTANCE_AND_INIT_LOG(
|
||||
&log, instance, inst, "xrGetOpenGLESGraphicsRequirementsKHR");
|
||||
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(
|
||||
&log, graphicsRequirements,
|
||||
XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR);
|
||||
OXR_VERIFY_SYSTEM_AND_GET(&log, inst, systemId, sys);
|
||||
|
||||
struct xrt_api_requirements ver;
|
||||
|
||||
xrt_gfx_gles_get_versions(&ver);
|
||||
|
||||
graphicsRequirements->minApiVersionSupported =
|
||||
XR_MAKE_VERSION(ver.min_major, ver.min_minor, ver.min_patch);
|
||||
graphicsRequirements->maxApiVersionSupported =
|
||||
XR_MAKE_VERSION(ver.max_major, ver.max_minor, ver.max_patch);
|
||||
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* OpenGL
|
||||
|
|
|
@ -49,6 +49,18 @@
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* XR_KHR_opengl_es_enable
|
||||
*/
|
||||
#if defined(XR_KHR_opengl_es_enable) && defined(XR_USE_GRAPHICS_API_OPENGL_ES)
|
||||
#define OXR_HAVE_KHR_opengl_es_enable
|
||||
#define OXR_EXTENSION_SUPPORT_KHR_opengl_es_enable(_) \
|
||||
_(KHR_opengl_es_enable, KHR_OPENGL_ES_ENABLE)
|
||||
#else
|
||||
#define OXR_EXTENSION_SUPPORT_KHR_opengl_es_enable(_)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* XR_KHR_vulkan_enable
|
||||
*/
|
||||
|
@ -107,6 +119,7 @@
|
|||
OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \
|
||||
OXR_EXTENSION_SUPPORT_KHR_convert_timespec_time(_) \
|
||||
OXR_EXTENSION_SUPPORT_KHR_opengl_enable(_) \
|
||||
OXR_EXTENSION_SUPPORT_KHR_opengl_es_enable(_) \
|
||||
OXR_EXTENSION_SUPPORT_KHR_vulkan_enable(_) \
|
||||
OXR_EXTENSION_SUPPORT_MND_egl_enable(_) \
|
||||
OXR_EXTENSION_SUPPORT_MND_headless(_)
|
||||
|
|
Loading…
Reference in a new issue