Monado OpenXR Runtime
u_format.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 Format helpers and block code.
6  * @author Jakob Bornecrantz <jakob@collabora.com>
7  * @ingroup aux_util
8  */
9 
10 #pragma once
11 
12 #include "xrt/xrt_defines.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 
19 /*!
20  * Return string for this format.
21  *
22  * @ingroup aux_util
23  */
24 const char *
25 u_format_str(enum xrt_format f);
26 
27 /*!
28  * Is this format block based, also returns true for formats that 1x1 blocks.
29  *
30  * @ingroup aux_util
31  */
32 bool
34 
35 /*!
36  * Returns the width of the block for the given format.
37  *
38  * @ingroup aux_util
39  */
40 uint32_t
42 
43 /*!
44  * Returns the height of the block for the given format.
45  *
46  * @ingroup aux_util
47  */
48 uint32_t
50 
51 /*!
52  * Returns the size of the block for the given format.
53  *
54  * @ingroup aux_util
55  */
56 size_t
58 
59 /*!
60  * Calculate stride and size for the format and given width and height.
61  *
62  * @ingroup aux_util
63  */
64 void
65 u_format_size_for_dimensions(enum xrt_format f, uint32_t width, uint32_t height, size_t *out_stride, size_t *out_size);
66 
67 
68 #ifdef __cplusplus
69 }
70 #endif
uint32_t u_format_block_height(enum xrt_format f)
Returns the height of the block for the given format.
Definition: u_format.c:88
uint32_t u_format_block_width(enum xrt_format f)
Returns the width of the block for the given format.
Definition: u_format.c:62
const char * u_format_str(enum xrt_format f)
Return string for this format.
Definition: u_format.c:16
size_t u_format_block_size(enum xrt_format f)
Returns the size of the block for the given format.
Definition: u_format.c:112
void u_format_size_for_dimensions(enum xrt_format f, uint32_t width, uint32_t height, size_t *out_stride, size_t *out_size)
Calculate stride and size for the format and given width and height.
Definition: u_format.c:141
bool u_format_is_blocks(enum xrt_format f)
Is this format block based, also returns true for formats that 1x1 blocks.
Definition: u_format.c:37
Common defines and enums for XRT.
xrt_format
Common formats, use u_format_* functions to reason about them.
Definition: xrt_defines.h:176