mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-12 09:55:33 +00:00
e5a9cbb2f9
This extension introduces a more robust way of creating an XrSession for OpenGL. It also lays the groundwork for future OpenGL ES support. https://github.com/KhronosGroup/OpenXR-Docs/pull/40 Signed-off-by: Simon Ser <contact@emersion.fr> Signed-off-by: Drew DeVault <sir@cmpwn.com>
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
// Copyright 2018-2019, Collabora, Ltd.
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
/*!
|
|
* @file
|
|
* @brief Holds OpenGL-specific session functions.
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
* @ingroup oxr_main
|
|
* @ingroup comp_client
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "util/u_misc.h"
|
|
|
|
#include "oxr_objects.h"
|
|
#include "oxr_logger.h"
|
|
#include "oxr_two_call.h"
|
|
#include "oxr_handle.h"
|
|
|
|
#ifdef XR_USE_PLATFORM_XLIB
|
|
#include "xrt/xrt_gfx_xlib.h"
|
|
#endif
|
|
|
|
#ifdef XR_USE_PLATFORM_XLIB
|
|
|
|
XrResult
|
|
oxr_session_populate_gl_xlib(struct oxr_logger *log,
|
|
struct oxr_system *sys,
|
|
XrGraphicsBindingOpenGLXlibKHR const *next,
|
|
struct oxr_session *sess)
|
|
{
|
|
struct xrt_compositor_gl *xcgl = xrt_gfx_provider_create_gl_xlib(
|
|
sys->head, sys->inst->timekeeping, next->xDisplay, next->visualid,
|
|
next->glxFBConfig, next->glxDrawable, next->glxContext);
|
|
|
|
if (xcgl == NULL) {
|
|
return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED,
|
|
" failed create a compositor");
|
|
}
|
|
|
|
sess->compositor = &xcgl->base;
|
|
sess->create_swapchain = oxr_swapchain_gl_create;
|
|
|
|
return XR_SUCCESS;
|
|
}
|
|
|
|
#endif
|