2019-03-18 05:52:32 +00:00
|
|
|
// Copyright 2019, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief OpenGL client side glue to compositor header.
|
|
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
|
|
* @ingroup comp_client
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "xrt/xrt_compositor.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Structs
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2020-06-03 16:43:30 +00:00
|
|
|
* @class client_gl_swapchain
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* Wraps the real compositor swapchain providing a OpenGL based interface.
|
|
|
|
*
|
|
|
|
* Almost a one to one mapping to a OpenXR swapchain.
|
|
|
|
*
|
|
|
|
* @ingroup comp_client
|
2020-06-03 16:43:30 +00:00
|
|
|
* @implements xrt_swapchain_gl
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct client_gl_swapchain
|
|
|
|
{
|
|
|
|
struct xrt_swapchain_gl base;
|
|
|
|
|
|
|
|
struct xrt_swapchain_fd *xscfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2020-06-03 16:43:30 +00:00
|
|
|
* @class client_gl_compositor
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* Wraps the real compositor providing a OpenGL based interface.
|
|
|
|
*
|
|
|
|
* @ingroup comp_client
|
2020-06-03 16:43:30 +00:00
|
|
|
* @implements xrt_compositor_gl
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct client_gl_compositor
|
|
|
|
{
|
|
|
|
struct xrt_compositor_gl base;
|
|
|
|
|
|
|
|
struct xrt_compositor_fd *xcfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Functions and helpers.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2020-06-03 16:43:30 +00:00
|
|
|
* Down-cast helper.
|
2020-06-03 21:26:34 +00:00
|
|
|
* @protected @memberof client_gl_compositor
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline struct client_gl_compositor *
|
2019-03-18 05:52:32 +00:00
|
|
|
client_gl_compositor(struct xrt_compositor *xc)
|
|
|
|
{
|
|
|
|
return (struct client_gl_compositor *)xc;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef void (*client_gl_void_ptr_func)();
|
|
|
|
|
|
|
|
typedef client_gl_void_ptr_func (*client_gl_get_procaddr)(const char *name);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Fill in a client_gl_compositor and do common OpenGL sanity checking.
|
2020-06-03 16:43:30 +00:00
|
|
|
*
|
|
|
|
* OpenGL can have multiple backing window systems we have to interact with, so
|
|
|
|
* there isn't just one unified OpenGL client constructor.
|
|
|
|
*
|
2020-06-03 17:04:06 +00:00
|
|
|
* Moves owenership of provided xcfd to the client_gl_compositor.
|
|
|
|
*
|
2020-06-03 16:43:30 +00:00
|
|
|
* @public @memberof client_gl_compositor
|
|
|
|
* @relatesalso xrt_compositor_fd
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
bool
|
|
|
|
client_gl_compositor_init(struct client_gl_compositor *c,
|
|
|
|
struct xrt_compositor_fd *xcfd,
|
|
|
|
client_gl_get_procaddr get_gl_procaddr);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|