summaryrefslogtreecommitdiffstats
path: root/thirdparty/libktx/lib/formatsize.h
blob: 149ff18d61f8c1eeecf2094c53f28ee121dd0d9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* -*- tab-width: 4; -*- */
/* vi: set sw=2 ts=4 expandtab: */

/*
 * Copyright 2019-2020 The Khronos Group Inc.
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * @internal
 * @file
 * @~English
 *
 * @brief Struct for returning size information about an image format.
 *
 * @author Mark Callow, www.edgewise-consulting.com
 */

#ifndef _FORMATSIZE_H_
#define _FORMATSIZE_H_

#include "ktx.h"

typedef enum ktxFormatSizeFlagBits {
    KTX_FORMAT_SIZE_PACKED_BIT                = 0x00000001,
    KTX_FORMAT_SIZE_COMPRESSED_BIT            = 0x00000002,
    KTX_FORMAT_SIZE_PALETTIZED_BIT            = 0x00000004,
    KTX_FORMAT_SIZE_DEPTH_BIT                 = 0x00000008,
    KTX_FORMAT_SIZE_STENCIL_BIT               = 0x00000010,
    KTX_FORMAT_SIZE_YUVSDA_BIT                = 0x00000020,
} ktxFormatSizeFlagBits;

typedef ktx_uint32_t ktxFormatSizeFlags;

/**
 * @brief Structure for holding size information for a texture format.
 */
typedef struct ktxFormatSize {
    ktxFormatSizeFlags  flags;
    unsigned int        paletteSizeInBits;  // For KTX1.
    unsigned int        blockSizeInBits;
    unsigned int        blockWidth;         // in texels
    unsigned int        blockHeight;        // in texels
    unsigned int        blockDepth;         // in texels
    unsigned int        minBlocksX;         // Minimum required number of blocks
    unsigned int        minBlocksY;
} ktxFormatSize;

#ifdef __cplusplus
extern "C" {
#endif

bool ktxFormatSize_initFromDfd(ktxFormatSize* This, ktx_uint32_t* pDfd);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* _FORMATSIZE_H_ */