Monado OpenXR Runtime
|
OpenGL client side glue to compositor header. More...
Go to the source code of this file.
Data Structures | |
class | client_gl_swapchain |
Wraps the real compositor swapchain providing a OpenGL based interface. More... | |
class | client_gl_compositor |
Wraps the real compositor providing a OpenGL based interface. More... | |
Typedefs | |
typedef xrt_result_t(* | client_gl_context_begin_locked_func_t) (struct xrt_compositor *xc, enum client_gl_context_reason reason) |
Fetches the OpenGL context that is current on this thread and makes the OpenGL context given in the graphics binding current instead. More... | |
typedef void(* | client_gl_context_end_locked_func_t) (struct xrt_compositor *xc, enum client_gl_context_reason reason) |
Makes the OpenGL context current that was current before client_gl_context_begin_locked_func_t was called. More... | |
typedef struct xrt_swapchain *(* | client_gl_swapchain_create_func_t) (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_native *xscn, struct client_gl_swapchain **out_sc) |
The type of a swapchain create constructor. More... | |
typedef xrt_result_t(* | client_gl_insert_fence_func_t) (struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle) |
The type of a fence insertion function. More... | |
Enumerations | |
enum | client_gl_context_reason { CLIENT_GL_CONTEXT_REASON_SYNCHRONIZE , CLIENT_GL_CONTEXT_REASON_OTHER } |
What's the reason to make the context current, this is needed currently for EGL where we have to create a shared context in some cases. More... | |
OpenGL client side glue to compositor header.
typedef xrt_result_t(* client_gl_context_begin_locked_func_t) (struct xrt_compositor *xc, enum client_gl_context_reason reason) |
Fetches the OpenGL context that is current on this thread and makes the OpenGL context given in the graphics binding current instead.
Only one thread at a time can operate on the sections between client_gl_context_begin_locked_func_t and client_gl_context_end_locked_func_t, therefore client_gl_context_end_locked_func_t MUST be called to avoid blocking the next thread calling client_gl_context_begin_locked_func_t.
This function must be called with the context_mutex locked held, that is handled by the helper function client_gl_compositor_context_begin.
If the return value is not XRT_SUCCESS, client_gl_context_end_locked_func_t should not be called.
typedef void(* client_gl_context_end_locked_func_t) (struct xrt_compositor *xc, enum client_gl_context_reason reason) |
Makes the OpenGL context current that was current before client_gl_context_begin_locked_func_t was called.
This function must be called with the context_mutex locked held, successful call to client_gl_compositor_context_begin will ensure that. The lock is not released by this function, but client_gl_compositor_context_end does release it.
typedef xrt_result_t(* client_gl_insert_fence_func_t) (struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle) |
The type of a fence insertion function.
This function is called in xrt_compositor::layer_commit.
The returned graphics sync handle is given to xrt_compositor::layer_commit.
typedef struct xrt_swapchain *(* client_gl_swapchain_create_func_t) (struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_native *xscn, struct client_gl_swapchain **out_sc) |
The type of a swapchain create constructor.
Because our swapchain creation varies depending on available extensions and application choices, the swapchain constructor parameter to client_gl_compositor is parameterized.
Note that the "common" swapchain creation function does some setup before invoking this, and some cleanup after.
destroy
What's the reason to make the context current, this is needed currently for EGL where we have to create a shared context in some cases.
But when we want to synchronize (insert a fence or call glFinish) we can not use the shared context and must use the context that the app provided on creation.