xrt: add support for OpenGL ES

This commit advertises the extension and adds support for
xrGetOpenGLESGraphicsRequirementsKHR
This commit is contained in:
Simon Ser 2019-10-29 11:08:11 +01:00
parent b358e22fd7
commit 5eacb6f309
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
10 changed files with 120 additions and 0 deletions

View file

@ -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'],

View file

@ -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

View 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;
}

View file

@ -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',

View 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

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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(_)