summaryrefslogtreecommitdiffstats
path: root/thirdparty/libktx/include/ktx.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/libktx/include/ktx.h')
-rw-r--r--thirdparty/libktx/include/ktx.h49
1 files changed, 41 insertions, 8 deletions
diff --git a/thirdparty/libktx/include/ktx.h b/thirdparty/libktx/include/ktx.h
index 0af87f2519..dcf5dae42a 100644
--- a/thirdparty/libktx/include/ktx.h
+++ b/thirdparty/libktx/include/ktx.h
@@ -25,6 +25,7 @@
* @snippet{doc} version.h API version
*/
+#include <limits.h>
#include <stdio.h>
#include <stdbool.h>
#include <sys/types.h>
@@ -156,6 +157,7 @@ extern "C" {
* @brief Required unpack alignment
*/
#define KTX_GL_UNPACK_ALIGNMENT 4
+#define KTX_FACESLICE_WHOLE_LEVEL UINT_MAX
#define KTX_TRUE true
#define KTX_FALSE false
@@ -176,15 +178,17 @@ typedef enum ktx_error_code_e {
KTX_FILE_WRITE_ERROR, /*!< An error occurred while writing to the file. */
KTX_GL_ERROR, /*!< GL operations resulted in an error. */
KTX_INVALID_OPERATION, /*!< The operation is not allowed in the current state. */
- KTX_INVALID_VALUE, /*!< A parameter value was not valid */
- KTX_NOT_FOUND, /*!< Requested key was not found */
+ KTX_INVALID_VALUE, /*!< A parameter value was not valid. */
+ KTX_NOT_FOUND, /*!< Requested metadata key or required dynamically loaded GPU function was not found. */
KTX_OUT_OF_MEMORY, /*!< Not enough memory to complete the operation. */
KTX_TRANSCODE_FAILED, /*!< Transcoding of block compressed texture failed. */
KTX_UNKNOWN_FILE_FORMAT, /*!< The file not a KTX file */
KTX_UNSUPPORTED_TEXTURE_TYPE, /*!< The KTX file specifies an unsupported texture type. */
KTX_UNSUPPORTED_FEATURE, /*!< Feature not included in in-use library or not yet implemented. */
KTX_LIBRARY_NOT_LINKED, /*!< Library dependency (OpenGL or Vulkan) not linked into application. */
- KTX_ERROR_MAX_ENUM = KTX_LIBRARY_NOT_LINKED /*!< For safety checks. */
+ KTX_DECOMPRESS_LENGTH_ERROR, /*!< Decompressed byte count does not match expected byte size */
+ KTX_DECOMPRESS_CHECKSUM_ERROR, /*!< Checksum mismatch when decompressing */
+ KTX_ERROR_MAX_ENUM = KTX_DECOMPRESS_CHECKSUM_ERROR /*!< For safety checks. */
} ktx_error_code_e;
/**
* @deprecated
@@ -672,8 +676,9 @@ typedef enum ktxSupercmpScheme {
KTX_SS_NONE = 0, /*!< No supercompression. */
KTX_SS_BASIS_LZ = 1, /*!< Basis LZ supercompression. */
KTX_SS_ZSTD = 2, /*!< ZStd supercompression. */
+ KTX_SS_ZLIB = 3, /*!< ZLIB supercompression. */
KTX_SS_BEGIN_RANGE = KTX_SS_NONE,
- KTX_SS_END_RANGE = KTX_SS_ZSTD,
+ KTX_SS_END_RANGE = KTX_SS_ZLIB,
KTX_SS_BEGIN_VENDOR_RANGE = 0x10000,
KTX_SS_END_VENDOR_RANGE = 0x1ffff,
KTX_SS_BEGIN_RESERVED = 0x20000,
@@ -703,15 +708,21 @@ typedef struct ktxTexture2 {
struct ktxTexture2_private* _private; /*!< Private data. */
} ktxTexture2;
+/**
+ * @brief Helper for casting ktxTexture1 and ktxTexture2 to ktxTexture.
+ *
+ * Use with caution.
+ */
#define ktxTexture(t) ((ktxTexture*)t)
/**
* @memberof ktxTexture
* @~English
- * @brief Structure for passing texture information to ktxTexture1_Create() and
- * ktxTexture2_Create().
+ * @brief Structure for passing texture information to ktxTexture1\_Create() and
+ * ktxTexture2\_Create().
*
- * @sa ktxTexture1_Create() and ktxTexture2_Create().
+ * @sa @ref ktxTexture1::ktxTexture1\_Create() "ktxTexture1_Create()"
+ * @sa @ref ktxTexture2::ktxTexture2\_Create() "ktxTexture2_Create()"
*/
typedef struct
{
@@ -766,9 +777,12 @@ enum ktxTextureCreateFlagBits {
KTX_TEXTURE_CREATE_RAW_KVDATA_BIT = 0x02,
/*!< Load the raw key-value data instead of
creating a @c ktxHashList from it. */
- KTX_TEXTURE_CREATE_SKIP_KVDATA_BIT = 0x04
+ KTX_TEXTURE_CREATE_SKIP_KVDATA_BIT = 0x04,
/*!< Skip any key-value data. This overrides
the RAW_KVDATA_BIT. */
+ KTX_TEXTURE_CREATE_CHECK_GLTF_BASISU_BIT = 0x08
+ /*!< Load texture compatible with the rules
+ of KHR_texture_basisu glTF extension */
};
/**
* @memberof ktxTexture
@@ -1053,6 +1067,9 @@ ktxTexture2_CompressBasis(ktxTexture2* This, ktx_uint32_t quality);
KTX_API KTX_error_code KTX_APIENTRY
ktxTexture2_DeflateZstd(ktxTexture2* This, ktx_uint32_t level);
+KTX_API KTX_error_code KTX_APIENTRY
+ktxTexture2_DeflateZLIB(ktxTexture2* This, ktx_uint32_t level);
+
KTX_API void KTX_APIENTRY
ktxTexture2_GetComponentInfo(ktxTexture2* This, ktx_uint32_t* numComponents,
ktx_uint32_t* componentByteLength);
@@ -1682,6 +1699,19 @@ KTX_API KTX_error_code KTX_APIENTRY ktxPrintInfoForStdioStream(FILE* stdioStream
KTX_API KTX_error_code KTX_APIENTRY ktxPrintInfoForNamedFile(const char* const filename);
KTX_API KTX_error_code KTX_APIENTRY ktxPrintInfoForMemory(const ktx_uint8_t* bytes, ktx_size_t size);
+/*===========================================================*
+ * Utilities for printing info about a KTX2 file. *
+ *===========================================================*/
+
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoTextForMemory(const ktx_uint8_t* bytes, ktx_size_t size);
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoTextForNamedFile(const char* const filename);
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoTextForStdioStream(FILE* stdioStream);
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoTextForStream(ktxStream* stream);
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoJSONForMemory(const ktx_uint8_t* bytes, ktx_size_t size, ktx_uint32_t base_indent, ktx_uint32_t indent_width, bool minified);
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoJSONForNamedFile(const char* const filename, ktx_uint32_t base_indent, ktx_uint32_t indent_width, bool minified);
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoJSONForStdioStream(FILE* stdioStream, ktx_uint32_t base_indent, ktx_uint32_t indent_width, bool minified);
+KTX_API KTX_error_code KTX_APIENTRY ktxPrintKTX2InfoJSONForStream(ktxStream* stream, ktx_uint32_t base_indent, ktx_uint32_t indent_width, bool minified);
+
#ifdef __cplusplus
}
#endif
@@ -1709,6 +1739,9 @@ KTX_API KTX_error_code KTX_APIENTRY ktxPrintInfoForMemory(const ktx_uint8_t* byt
@~English
@page libktx_history Revision History
+No longer updated. Kept to preserve ancient history. For more recent history see the repo log at
+https://github.com/KhronosGroup/KTX-Software. See also the Release Notes in the repo.
+
@section v8 Version 4.0
Added:
@li Support for KTX Version 2.