Monado OpenXR Runtime
comp_gl_client.h
Go to the documentation of this file.
1 // Copyright 2019, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief OpenGL client side glue to compositor header.
6  * @author Jakob Bornecrantz <jakob@collabora.com>
7  * @ingroup comp_client
8  */
9 
10 #pragma once
11 
12 #include "xrt/xrt_compositor.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 
19 /*
20  *
21  * Structs
22  *
23  */
24 
25 /*!
26  * Wraps the real compositor swapchain providing a OpenGL based interface.
27  *
28  * Almost a one to one mapping to a OpenXR swapchain.
29  *
30  * @ingroup comp_client
31  */
33 {
34  struct xrt_swapchain_gl base;
35 
36  struct xrt_swapchain_fd *xscfd;
37 };
38 
39 /*!
40  * Wraps the real compositor providing a OpenGL based interface.
41  *
42  * @ingroup comp_client
43  */
45 {
46  struct xrt_compositor_gl base;
47 
48  struct xrt_compositor_fd *xcfd;
49 };
50 
51 
52 /*
53  *
54  * Functions and helpers.
55  *
56  */
57 
58 /*!
59  * Convinence function to convert a xrt_swapchain to a client_gl_swapchain.
60  */
61 static inline struct client_gl_swapchain *
63 {
64  return (struct client_gl_swapchain *)xsc;
65 }
66 
67 /*!
68  * Convinence function to convert a xrt_compositor to a client_gl_compositor.
69  */
70 static inline struct client_gl_compositor *
72 {
73  return (struct client_gl_compositor *)xc;
74 }
75 
76 typedef void (*client_gl_void_ptr_func)();
77 
78 typedef client_gl_void_ptr_func (*client_gl_get_procaddr)(const char *name);
79 
80 /*!
81  * Fill in a client_gl_compositor and do common OpenGL sanity checking.
82  */
83 bool
85  struct xrt_compositor_fd *xcfd,
86  client_gl_get_procaddr get_gl_procaddr);
87 
88 
89 #ifdef __cplusplus
90 }
91 #endif
Main compositor.
Definition: xrt_compositor.h:474
A swapchain that exposes fd to be imported into a client API.
Definition: xrt_compositor.h:462
Definition: xrt_compositor.h:358
Common swapchain base.
Definition: xrt_compositor.h:75
Definition: xrt_compositor.h:371
Header defining a XRT graphics provider.
Wraps the real compositor providing a OpenGL based interface.
Definition: comp_gl_client.h:44
Common compositor base.
Definition: xrt_compositor.h:116
Wraps the real compositor swapchain providing a OpenGL based interface.
Definition: comp_gl_client.h:32
bool client_gl_compositor_init(struct client_gl_compositor *c, struct xrt_compositor_fd *xcfd, client_gl_get_procaddr get_gl_procaddr)
Fill in a client_gl_compositor and do common OpenGL sanity checking.
Definition: comp_gl_client.c:256