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 texture_funcs.h
12 * @~English
13 *
14 * @brief Templates for functions common to base & derived ktxTexture classes.
15 *
16 * Define CLASS before including this file.
17 */
18
19#define CAT(c, n) PRIMITIVE_CAT(c, n)
20#define PRIMITIVE_CAT(c, n) c ## _ ## n
21
22#define CLASS_FUNC(name) CAT(CLASS, name)
23
24/*
25 ======================================
26 Virtual ktxTexture functions
27 ======================================
28*/
29
30
31void CLASS_FUNC(Destroy)(CLASS* This);
32KTX_error_code CLASS_FUNC(GetImageOffset)(CLASS* This, ktx_uint32_t level,
33 ktx_uint32_t layer,
34 ktx_uint32_t faceSlice,
35 ktx_size_t* pOffset);
36ktx_size_t CLASS_FUNC(GetImageSize)(CLASS* This, ktx_uint32_t level);
37KTX_error_code CLASS_FUNC(GLUpload)(CLASS* This, GLuint* pTexture,
38 GLenum* pTarget, GLenum* pGlerror);
39KTX_error_code CLASS_FUNC(IterateLevels)(CLASS* This,
40 PFNKTXITERCB iterCb,
41 void* userdata);
42KTX_error_code CLASS_FUNC(IterateLevelFaces)(CLASS* This,
43 PFNKTXITERCB iterCb,
44 void* userdata);
45KTX_error_code CLASS_FUNC(IterateLoadLevelFaces)(CLASS* This,
46 PFNKTXITERCB iterCb,
47 void* userdata);
48KTX_error_code CLASS_FUNC(LoadImageData)(CLASS* This,
49 ktx_uint8_t* pBuffer,
50 ktx_size_t bufSize);
51KTX_error_code CLASS_FUNC(SetImageFromStdioStream)(CLASS* This,
52 ktx_uint32_t level,ktx_uint32_t layer,
53 ktx_uint32_t faceSlice,
54 FILE* src, ktx_size_t srcSize);
55KTX_error_code CLASS_FUNC(SetImageFromMemory)(CLASS* This,
56 ktx_uint32_t level, ktx_uint32_t layer,
57 ktx_uint32_t faceSlice,
58 const ktx_uint8_t* src, ktx_size_t srcSize);
59
60KTX_error_code CLASS_FUNC(WriteToStdioStream)(CLASS* This, FILE* dstsstr);
61KTX_error_code CLASS_FUNC(WriteToNamedFile)(CLASS* This,
62 const char* const dstname);
63KTX_error_code CLASS_FUNC(WriteToMemory)(CLASS* This,
64 ktx_uint8_t** ppDstBytes, ktx_size_t* pSize);
65KTX_error_code CLASS_FUNC(WriteToStream)(CLASS* This,
66 ktxStream* dststr);
67
68/*
69 ======================================
70 Internal ktxTexture functions
71 ======================================
72*/
73
74
75void CLASS_FUNC(destruct)(CLASS* This);
76
77