Monado OpenXR Runtime
ogl_helpers.h
Go to the documentation of this file.
1// Copyright 2020-2023, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Common OpenGL code header.
6 * @author Rylie Pavlik <rylie.pavlik@collabora.com>
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @ingroup aux_ogl
9 */
10
11#pragma once
12
13#include "xrt/xrt_compositor.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19
20/*!
21 * Results from a import, nicer then having to pass in multiple arrays.
22 *
23 * @ingroup aux_ogl
24 */
26{
27 //! Imported textures.
29
30 //! Memory objects for imported textures.
32
33 //! The count of textures and memories.
34 uint32_t image_count;
35
36 //! Dimensions.
37 uint32_t width, height;
38};
39
40/*!
41 * Determine the texture target and the texture binding parameter to
42 * save/restore for creation/use of an OpenGL texture from the given info.
43 *
44 * @ingroup aux_ogl
45 */
46void
48 uint32_t *out_tex_target,
49 uint32_t *out_tex_param_name);
50
51/*!
52 * Converts a Vulkan format to corresponding OpenGL format,
53 * will return 0 if no mapping exist for the given format.
54 *
55 * @ingroup aux_ogl
56 */
57XRT_CHECK_RESULT uint32_t
58ogl_vk_format_to_gl(int64_t vk_format);
59
60/*!
61 * Import native images, a context needs to be current when called.
62 *
63 * @ingroup aux_ogl
64 */
65XRT_CHECK_RESULT bool
67 uint32_t native_count,
68 const struct xrt_swapchain_create_info *info,
69 struct ogl_import_results *results);
70
71
72#ifdef __cplusplus
73}
74#endif
XRT_CHECK_RESULT uint32_t ogl_vk_format_to_gl(int64_t vk_format)
Converts a Vulkan format to corresponding OpenGL format, will return 0 if no mapping exist for the gi...
Definition: ogl_helpers.c:68
void ogl_texture_target_for_swapchain_info(const struct xrt_swapchain_create_info *info, uint32_t *out_tex_target, uint32_t *out_tex_param_name)
Determine the texture target and the texture binding parameter to save/restore for creation/use of an...
Definition: ogl_helpers.c:38
XRT_CHECK_RESULT bool ogl_import_from_native(struct xrt_image_native *natives, uint32_t native_count, const struct xrt_swapchain_create_info *info, struct ogl_import_results *results)
Import native images, a context needs to be current when called.
Definition: ogl_helpers.c:96
#define XRT_MAX_SWAPCHAIN_IMAGES
Max swapchain images, artificial limit.
Definition: xrt_limits.h:34
Results from a import, nicer then having to pass in multiple arrays.
Definition: ogl_helpers.h:26
uint32_t textures[XRT_MAX_SWAPCHAIN_IMAGES]
Imported textures.
Definition: ogl_helpers.h:28
uint32_t width
Dimensions.
Definition: ogl_helpers.h:37
uint32_t image_count
The count of textures and memories.
Definition: ogl_helpers.h:34
uint32_t memories[XRT_MAX_SWAPCHAIN_IMAGES]
Memory objects for imported textures.
Definition: ogl_helpers.h:31
A single image of a swapchain based on native buffer handles.
Definition: xrt_compositor.h:2150
Swapchain creation info.
Definition: xrt_compositor.h:876
Header declaring XRT graphics interfaces.