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 texture2.h
12 * @~English
13 *
14 * @brief Declare internal ktxTexture2 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 _TEXTURE2_H_
21#define _TEXTURE2_H_
22
23#include "texture.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#define CLASS ktxTexture2
30#include "texture_funcs.inl"
31#undef CLASS
32
33typedef struct ktxTexture2_private {
34 ktx_uint8_t* _supercompressionGlobalData;
35 ktx_uint32_t _requiredLevelAlignment;
36 ktx_uint64_t _sgdByteLength;
37 ktx_uint64_t _firstLevelFileOffset; /*!< Always 0, unless the texture was
38 created from a stream and the image
39 data is not yet loaded. */
40 // Must be last so it can grow.
41 ktxLevelIndexEntry _levelIndex[1]; /*!< Offsets in this index are from the
42 start of the image data. Use
43 ktxTexture_levelStreamOffset() and
44 ktxTexture_levelDataOffset(). The former
45 will add the above file offset to the
46 index offset. */
47} ktxTexture2_private;
48
49KTX_error_code
50ktxTexture2_LoadImageData(ktxTexture2* This,
51 ktx_uint8_t* pBuffer, ktx_size_t bufSize);
52
53KTX_error_code
54ktxTexture2_constructFromStreamAndHeader(ktxTexture2* This, ktxStream* pStream,
55 KTX_header2* pHeader,
56 ktxTextureCreateFlags createFlags);
57
58ktx_uint64_t ktxTexture2_calcDataSizeTexture(ktxTexture2* This);
59ktx_size_t ktxTexture2_calcLevelOffset(ktxTexture2* This, ktx_uint32_t level);
60ktx_uint32_t ktxTexture2_calcRequiredLevelAlignment(ktxTexture2* This);
61ktx_uint64_t ktxTexture2_levelFileOffset(ktxTexture2* This, ktx_uint32_t level);
62ktx_uint64_t ktxTexture2_levelDataOffset(ktxTexture2* This, ktx_uint32_t level);
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* _TEXTURE2_H_ */
69