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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Wraps the real compositor swapchain providing a OpenGL based interface.
|
|
|
|
*
|
|
|
|
* Almost a one to one mapping to a OpenXR swapchain.
|
|
|
|
*
|
|
|
|
* @ingroup comp_client
|
|
|
|
*/
|
|
|
|
struct client_gl_swapchain
|
|
|
|
{
|
|
|
|
struct xrt_swapchain_gl base;
|
|
|
|
|
|
|
|
struct xrt_swapchain_fd *xscfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Wraps the real compositor providing a OpenGL based interface.
|
|
|
|
*
|
|
|
|
* @ingroup comp_client
|
|
|
|
*/
|
|
|
|
struct client_gl_compositor
|
|
|
|
{
|
|
|
|
struct xrt_compositor_gl base;
|
|
|
|
|
|
|
|
struct xrt_compositor_fd *xcfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Functions and helpers.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
2020-04-09 13:49:37 +00:00
|
|
|
* Convenience function to convert a xrt_swapchain to a client_gl_swapchain.
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline struct client_gl_swapchain *
|
2019-03-18 05:52:32 +00:00
|
|
|
client_gl_swapchain(struct xrt_swapchain *xsc)
|
|
|
|
{
|
|
|
|
return (struct client_gl_swapchain *)xsc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2020-04-09 13:49:37 +00:00
|
|
|
* Convenience function to convert a xrt_compositor to a 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.
|
|
|
|
*/
|
|
|
|
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
|