Debian Codegraph @

thirdparty/libktx/lib/texture.h

raw symbols SCIP
1 /* -*- tab-width: 4; -*- */
2 /* vi: set sw=2 ts=4 expandtab textwidth=70: */
3
4 /*
5 * Copyright 2019-2020 The Khronos Group Inc.
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9 /**
10 * @internal
11 * @file
12 * @~English
13 *
14 * @brief Declare internal ktxTexture functions for sharing between
15 * compilation units.
16 *
17 * These functions are private and should not be used outside the library.
18 */
19
20 #ifndef _TEXTURE_H_
21 #define _TEXTURE_H_
22
23 #include "ktx.h"
24 #include "formatsize.h"
25
26 #define DECLARE_PRIVATE(class) class ## _private* private = This->_private
27 #define DECLARE_PROTECTED(class) class ## _protected* prtctd = This->_protected;
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 typedef enum {
34 KTX_FORMAT_VERSION_ONE = 1,
35 KTX_FORMAT_VERSION_TWO = 2
36 } ktxFormatVersionEnum;
37
38 typedef ktx_size_t (* PFNCALCDATASIZELEVELS)(ktxTexture* This,
39 ktx_uint32_t levels);
40 typedef ktx_size_t (* PFNCALCFACELODSIZE)(ktxTexture* This, ktx_uint32_t level);
41 typedef ktx_size_t (* PFNCALCLEVELOFFSET)(ktxTexture* This, ktx_uint32_t level);
42 typedef struct ktxTexture_vtblInt {
43 PFNCALCDATASIZELEVELS calcDataSizeLevels;
44 PFNCALCFACELODSIZE calcFaceLodSize;
45 PFNCALCLEVELOFFSET calcLevelOffset;
46 } ktxTexture_vtblInt;
47
48 #define ktxTexture_calcDataSizeLevels(This, levels) \
49 This->_protected->_vtbl.calcDataSizeLevels(This, levels);
50 #define ktxTexture_calcFaceLodSize(This, level) \
51 This->_protected->_vtbl.calcFaceLodSize(This, level);
52 #define ktxTexture_calcLevelOffset(This, level) \
53 This->_protected->_vtbl.calcLevelOffset(This, level);
54
55 /**
56 * @memberof ktxTexture
57 * @~English
58 *
59 * @brief protected members of ktxTexture.
60 */
61 typedef struct ktxTexture_protected {
62 ktxTexture_vtblInt _vtbl;
63 ktxFormatSize _formatSize;
64 ktx_uint32_t _typeSize;
65 ktxStream _stream;
66 } ktxTexture_protected;
67
68 #define ktxTexture_getStream(t) ((ktxStream*)(&(t)->_protected->_stream))
69 #define ktxTexture1_getStream(t1) ktxTexture_getStream((ktxTexture*)t1)
70 #define ktxTexture2_getStream(t2) ktxTexture_getStream((ktxTexture*)t2)
71
72 KTX_error_code
73 ktxTexture_iterateLoadedImages(ktxTexture* This, PFNKTXITERCB iterCb,
74 void* userdata);
75 KTX_error_code
76 ktxTexture_iterateSourceImages(ktxTexture* This, PFNKTXITERCB iterCb,
77 void* userdata);
78
79 ktx_size_t ktxTexture_calcDataSizeTexture(ktxTexture* This);
80 ktx_size_t ktxTexture_calcImageSize(ktxTexture* This, ktx_uint32_t level,
81 ktxFormatVersionEnum fv);
82 ktx_bool_t ktxTexture_isActiveStream(ktxTexture* This);
83 ktx_size_t ktxTexture_calcLevelSize(ktxTexture* This, ktx_uint32_t level,
84 ktxFormatVersionEnum fv);
85 ktx_size_t ktxTexture_doCalcFaceLodSize(ktxTexture* This, ktx_uint32_t level,
86 ktxFormatVersionEnum fv);
87 ktx_size_t ktxTexture_layerSize(ktxTexture* This, ktx_uint32_t level,
88 ktxFormatVersionEnum fv);
89 void ktxTexture_rowInfo(ktxTexture* This, ktx_uint32_t level,
90 ktx_uint32_t* numRows, ktx_uint32_t* rowBytes,
91 ktx_uint32_t* rowPadding);
92 KTX_error_code
93 ktxTexture_construct(ktxTexture* This,
94 const ktxTextureCreateInfo* const createInfo,
95 ktxFormatSize* formatSize);
96
97 KTX_error_code
98 ktxTexture_constructFromStream(ktxTexture* This, ktxStream* pStream,
99 ktxTextureCreateFlags createFlags);
100
101 void
102 ktxTexture_destruct(ktxTexture* This);
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif /* _TEXTURE_H_ */