Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libktx: Update to 4.3.1 #88075

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/ktx/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ thirdparty_sources = [
"lib/filestream.c",
"lib/hashlist.c",
"lib/memstream.c",
"lib/miniz_wrapper.cpp",
"lib/swap.c",
"lib/texture.c",
"lib/texture1.c",
"lib/texture2.c",
"lib/vkformat_check.c",
"lib/dfdutils/createdfd.c",
"lib/dfdutils/colourspaces.c",
"lib/dfdutils/interpretdfd.c",
Expand All @@ -33,7 +35,11 @@ env_ktx.Prepend(CPPPATH=[thirdparty_dir + "include"])
env_ktx.Prepend(CPPPATH=[thirdparty_dir + "utils"])
env_ktx.Prepend(CPPPATH=[thirdparty_dir + "lib"])
env_ktx.Prepend(CPPPATH=[thirdparty_dir + "other_include"])

env_ktx.Prepend(CPPPATH=["#thirdparty/basis_universal"])
if env.editor_build:
# We already build miniz in the basis_universal module (editor only).
env_ktx.Append(CPPDEFINES=["MINIZ_HEADER_FILE_ONLY"])

if env["vulkan"]:
env_ktx.Prepend(CPPPATH=["#thirdparty/vulkan/include"])
Expand Down
12 changes: 7 additions & 5 deletions thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,19 +426,21 @@ Files extracted from upstream source:
## libktx

- Upstream: https://github.com/KhronosGroup/KTX-Software
- Version: 4.1.0 (d7255fe73cd53b856731ceb9f2c279181d0dbbca, 2023)
- Version: 4.3.1 (c0214158d551cfc779624b0f84130bcbbefef59a, 2024)
- License: Apache-2.0

Files extracted from upstream source:

- `LICENSE.md`
- `include/*`
- `lib/dfdutils/{LICENSES/Apache-2.0.txt,KHR,*.c,*.h,*.inl}`
- `lib/{basis_sgd.h,basis_transcode.cpp,checkheader.c,filestream.*,formatsize.h,gl_format.h,hashlist.c,ktxint.h,memstream.*,swap.c,texture*,uthash.h,vk_format.h,vkformat_enum.h}`
Chubercik marked this conversation as resolved.
Show resolved Hide resolved
- `utils/unused.h`
- `lib/dfdutils/LICENSE.adoc` as `LICENSE.dfdutils.adoc` (in root)
- `lib/dfdutils/LICENSES/Apache-2.0.txt` as `Apache-2.0.txt` (in root)
- `lib/dfdutils/{KHR/*,dfd.h,colourspaces.c,createdfd.c,interpretdfd.c,printdfd.c,queries.c,dfd2vk.inl,vk2dfd.*}`
- `lib/{basis_sgd.h,formatsize.h,gl_format.h,ktxint.h,uthash.h,vk_format.h,vkformat_enum.h,checkheader.c,swap.c,hashlist.c,vkformat_check.c,basis_transcode.cpp,miniz_wrapper.cpp,filestream.*,memstream.*,texture*}`
- `other_include/KHR/*`
- `utils/unused.h`

Some Godot-specific changes are applied via `godot.patch`.
Some Godot-specific changes are applied via patches included in the `patches` folder.


## libogg
Expand Down
45 changes: 0 additions & 45 deletions thirdparty/libktx/godot.patch

This file was deleted.

163 changes: 87 additions & 76 deletions thirdparty/libktx/include/KHR/khr_df.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#ifndef _KHR_DATA_FORMAT_H_
#define _KHR_DATA_FORMAT_H_

/** @file khr_df.h

@brief Data Format enums and macros.
*/

/* Accessors */
typedef enum _khr_word_e {
KHR_DF_WORD_VENDORID = 0U,
Expand Down Expand Up @@ -217,41 +222,42 @@ typedef enum _khr_df_versionnumber_e {
KHR_DF_VERSIONNUMBER_MAX = 0xFFFFU
} khr_df_versionnumber_e;

/* Model in which the color coordinate space is defined.
/** @~English
@brief Model in which the color coordinate space is defined.
There is no requirement that a color format use all the
channel types that are defined in the color model. */
typedef enum _khr_df_model_e {
/* No interpretation of color channels defined */
/** No interpretation of color channels defined */
KHR_DF_MODEL_UNSPECIFIED = 0U,
/* Color primaries (red, green, blue) + alpha, depth and stencil */
/** Color primaries (red, green, blue) + alpha, depth and stencil */
KHR_DF_MODEL_RGBSDA = 1U,
/* Color differences (Y', Cb, Cr) + alpha, depth and stencil */
/** Color differences (Y', Cb, Cr) + alpha, depth and stencil */
KHR_DF_MODEL_YUVSDA = 2U,
/* Color differences (Y', I, Q) + alpha, depth and stencil */
/** Color differences (Y', I, Q) + alpha, depth and stencil */
KHR_DF_MODEL_YIQSDA = 3U,
/* Perceptual color (CIE L*a*b*) + alpha, depth and stencil */
/** Perceptual color (CIE L*a*b*) + alpha, depth and stencil */
KHR_DF_MODEL_LABSDA = 4U,
/* Subtractive colors (cyan, magenta, yellow, black) + alpha */
/** Subtractive colors (cyan, magenta, yellow, black) + alpha */
KHR_DF_MODEL_CMYKA = 5U,
/* Non-color coordinate data (X, Y, Z, W) */
/** Non-color coordinate data (X, Y, Z, W) */
KHR_DF_MODEL_XYZW = 6U,
/* Hue, saturation, value, hue angle on color circle, plus alpha */
/** Hue, saturation, value, hue angle on color circle, plus alpha */
KHR_DF_MODEL_HSVA_ANG = 7U,
/* Hue, saturation, lightness, hue angle on color circle, plus alpha */
/** Hue, saturation, lightness, hue angle on color circle, plus alpha */
KHR_DF_MODEL_HSLA_ANG = 8U,
/* Hue, saturation, value, hue on color hexagon, plus alpha */
/** Hue, saturation, value, hue on color hexagon, plus alpha */
KHR_DF_MODEL_HSVA_HEX = 9U,
/* Hue, saturation, lightness, hue on color hexagon, plus alpha */
/** Hue, saturation, lightness, hue on color hexagon, plus alpha */
KHR_DF_MODEL_HSLA_HEX = 10U,
/* Lightweight approximate color difference (luma, orange, green) */
/** Lightweight approximate color difference (luma, orange, green) */
KHR_DF_MODEL_YCGCOA = 11U,
/* ITU BT.2020 constant luminance YcCbcCrc */
/** ITU BT.2020 constant luminance YcCbcCrc */
KHR_DF_MODEL_YCCBCCRC = 12U,
/* ITU BT.2100 constant intensity ICtCp */
/** ITU BT.2100 constant intensity ICtCp */
KHR_DF_MODEL_ICTCP = 13U,
/* CIE 1931 XYZ color coordinates (X, Y, Z) */
/** CIE 1931 XYZ color coordinates (X, Y, Z) */
KHR_DF_MODEL_CIEXYZ = 14U,
/* CIE 1931 xyY color coordinates (X, Y, Y) */
/** CIE 1931 xyY color coordinates (X, Y, Y) */
KHR_DF_MODEL_CIEXYY = 15U,

/* Compressed formats start at 128. */
Expand All @@ -260,51 +266,54 @@ typedef enum _khr_df_model_e {
channels are used to distinguish formats, these should be cosited. */
/* Direct3D (and S3) compressed formats */
/* Note that premultiplied status is recorded separately */
/* DXT1 "channels" are RGB (0), Alpha (1) */
/* DXT1/BC1 with one channel is opaque */
/* DXT1/BC1 with a cosited alpha sample is transparent */
/** DXT1 "channels" are RGB (0), Alpha (1)
DXT1/BC1 with one channel is opaque
DXT1/BC1 with a cosited alpha sample is transparent */
KHR_DF_MODEL_DXT1A = 128U,
KHR_DF_MODEL_BC1A = 128U,
/* DXT2/DXT3/BC2, with explicit 4-bit alpha */
/** DXT2/DXT3/BC2, with explicit 4-bit alpha */
KHR_DF_MODEL_DXT2 = 129U,
KHR_DF_MODEL_DXT3 = 129U,
KHR_DF_MODEL_BC2 = 129U,
/* DXT4/DXT5/BC3, with interpolated alpha */
/** DXT4/DXT5/BC3, with interpolated alpha */
KHR_DF_MODEL_DXT4 = 130U,
KHR_DF_MODEL_DXT5 = 130U,
KHR_DF_MODEL_BC3 = 130U,
/* BC4 - single channel interpolated 8-bit data */
/* (The UNORM/SNORM variation is recorded in the channel data) */
/** BC4 - single channel interpolated 8-bit data
(The UNORM/SNORM variation is recorded in the channel data) */
KHR_DF_MODEL_BC4 = 131U,
/* BC5 - two channel interpolated 8-bit data */
/* (The UNORM/SNORM variation is recorded in the channel data) */
/** BC5 - two channel interpolated 8-bit data
(The UNORM/SNORM variation is recorded in the channel data) */
KHR_DF_MODEL_BC5 = 132U,
/* BC6H - DX11 format for 16-bit float channels */
/** BC6H - DX11 format for 16-bit float channels */
KHR_DF_MODEL_BC6H = 133U,
/* BC7 - DX11 format */
/** BC7 - DX11 format */
KHR_DF_MODEL_BC7 = 134U,
/* Gap left for future desktop expansion */

/* Mobile compressed formats follow */
/* A format of ETC1 indicates that the format shall be decodable
by an ETC1-compliant decoder and not rely on ETC2 features */
/** A format of ETC1 indicates that the format shall be decodable
by an ETC1-compliant decoder and not rely on ETC2 features */
KHR_DF_MODEL_ETC1 = 160U,
/* A format of ETC2 is permitted to use ETC2 encodings on top of
the baseline ETC1 specification */
/* The ETC2 format has channels "red", "green", "RGB" and "alpha",
which should be cosited samples */
/* Punch-through alpha can be distinguished from full alpha by
the plane size in bytes required for the texel block */
/** A format of ETC2 is permitted to use ETC2 encodings on top of
the baseline ETC1 specification.
The ETC2 format has channels "red", "green", "RGB" and "alpha",
which should be cosited samples.
Punch-through alpha can be distinguished from full alpha by
the plane size in bytes required for the texel block */
KHR_DF_MODEL_ETC2 = 161U,
/* Adaptive Scalable Texture Compression */
/* ASTC HDR vs LDR is determined by the float flag in the channel */
/* ASTC block size can be distinguished by texel block size */
/** Adaptive Scalable Texture Compression */
/** ASTC HDR vs LDR is determined by the float flag in the channel */
/** ASTC block size can be distinguished by texel block size */
KHR_DF_MODEL_ASTC = 162U,
/* ETC1S is a simplified subset of ETC1 */
/** ETC1S is a simplified subset of ETC1 */
KHR_DF_MODEL_ETC1S = 163U,
/* PowerVR Texture Compression */
/** PowerVR Texture Compression v1 */
KHR_DF_MODEL_PVRTC = 164U,
/** PowerVR Texture Compression v2 */
KHR_DF_MODEL_PVRTC2 = 165U,
/** UASTC is a transcodable subset of ASTC
with additions to support the transcoding. */
KHR_DF_MODEL_UASTC = 166U,
/* Proprietary formats (ATITC, etc.) should follow */
KHR_DF_MODEL_MAX = 0xFFU
Expand Down Expand Up @@ -520,86 +529,88 @@ typedef enum _khr_df_model_channels_e {
KHR_DF_CHANNEL_COMMON_A = 15U
} khr_df_model_channels_e;

/* Definition of the primary colors in color coordinates.
/** @~English
@brief Definition of the primary colors in color coordinates.
This is implicitly responsible for defining the conversion
between RGB an YUV color spaces.
LAB and related absolute color models should use
KHR_DF_PRIMARIES_CIEXYZ. */
typedef enum _khr_df_primaries_e {
/* No color primaries defined */
/** No color primaries defined */
KHR_DF_PRIMARIES_UNSPECIFIED = 0U,
/* Color primaries of ITU-R BT.709 and sRGB */
/** Color primaries of ITU-R BT.709 and sRGB */
KHR_DF_PRIMARIES_BT709 = 1U,
/* Synonym for KHR_DF_PRIMARIES_BT709 */
/** Synonym for KHR_DF_PRIMARIES_BT709 */
KHR_DF_PRIMARIES_SRGB = 1U,
/* Color primaries of ITU-R BT.601 (625-line EBU variant) */
/** Color primaries of ITU-R BT.601 (625-line EBU variant) */
KHR_DF_PRIMARIES_BT601_EBU = 2U,
/* Color primaries of ITU-R BT.601 (525-line SMPTE C variant) */
/** Color primaries of ITU-R BT.601 (525-line SMPTE C variant) */
KHR_DF_PRIMARIES_BT601_SMPTE = 3U,
/* Color primaries of ITU-R BT.2020 */
/** Color primaries of ITU-R BT.2020 */
KHR_DF_PRIMARIES_BT2020 = 4U,
/* CIE theoretical color coordinate space */
/** CIE theoretical color coordinate space */
KHR_DF_PRIMARIES_CIEXYZ = 5U,
/* Academy Color Encoding System primaries */
/** Academy Color Encoding System primaries */
KHR_DF_PRIMARIES_ACES = 6U,
/* Color primaries of ACEScc */
/** Color primaries of ACEScc */
KHR_DF_PRIMARIES_ACESCC = 7U,
/* Legacy NTSC 1953 primaries */
/** Legacy NTSC 1953 primaries */
KHR_DF_PRIMARIES_NTSC1953 = 8U,
/* Legacy PAL 525-line primaries */
/** Legacy PAL 525-line primaries */
KHR_DF_PRIMARIES_PAL525 = 9U,
/* Color primaries of Display P3 */
/** Color primaries of Display P3 */
KHR_DF_PRIMARIES_DISPLAYP3 = 10U,
/* Color primaries of Adobe RGB (1998) */
/** Color primaries of Adobe RGB (1998) */
KHR_DF_PRIMARIES_ADOBERGB = 11U,
KHR_DF_PRIMARIES_MAX = 0xFFU
} khr_df_primaries_e;

/* Definition of the optical to digital transfer function
/** @~English
@brief Definition of the optical to digital transfer function
("gamma correction"). Most transfer functions are not a pure
power function and also include a linear element.
LAB and related absolute color representations should use
KHR_DF_TRANSFER_UNSPECIFIED. */
typedef enum _khr_df_transfer_e {
/* No transfer function defined */
/** No transfer function defined */
KHR_DF_TRANSFER_UNSPECIFIED = 0U,
/* Linear transfer function (value proportional to intensity) */
/** Linear transfer function (value proportional to intensity) */
KHR_DF_TRANSFER_LINEAR = 1U,
/* Perceptually-linear transfer function of sRGH (~2.4) */
/** Perceptually-linear transfer function of sRGH (~2.4) */
KHR_DF_TRANSFER_SRGB = 2U,
/* Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45) */
/** Perceptually-linear transfer function of ITU BT.601, BT.709 and BT.2020 (~1/.45) */
KHR_DF_TRANSFER_ITU = 3U,
/* SMTPE170M (digital NTSC) defines an alias for the ITU transfer function (~1/.45) */
/** SMTPE170M (digital NTSC) defines an alias for the ITU transfer function (~1/.45) */
KHR_DF_TRANSFER_SMTPE170M = 3U,
/* Perceptually-linear gamma function of original NTSC (simple 2.2 gamma) */
/** Perceptually-linear gamma function of original NTSC (simple 2.2 gamma) */
KHR_DF_TRANSFER_NTSC = 4U,
/* Sony S-log used by Sony video cameras */
/** Sony S-log used by Sony video cameras */
KHR_DF_TRANSFER_SLOG = 5U,
/* Sony S-log 2 used by Sony video cameras */
/** Sony S-log 2 used by Sony video cameras */
KHR_DF_TRANSFER_SLOG2 = 6U,
/* ITU BT.1886 EOTF */
/** ITU BT.1886 EOTF */
KHR_DF_TRANSFER_BT1886 = 7U,
/* ITU BT.2100 HLG OETF */
/** ITU BT.2100 HLG OETF */
KHR_DF_TRANSFER_HLG_OETF = 8U,
/* ITU BT.2100 HLG EOTF */
/** ITU BT.2100 HLG EOTF */
KHR_DF_TRANSFER_HLG_EOTF = 9U,
/* ITU BT.2100 PQ EOTF */
/** ITU BT.2100 PQ EOTF */
KHR_DF_TRANSFER_PQ_EOTF = 10U,
/* ITU BT.2100 PQ OETF */
/** ITU BT.2100 PQ OETF */
KHR_DF_TRANSFER_PQ_OETF = 11U,
/* DCI P3 transfer function */
/** DCI P3 transfer function */
KHR_DF_TRANSFER_DCIP3 = 12U,
/* Legacy PAL OETF */
/** Legacy PAL OETF */
KHR_DF_TRANSFER_PAL_OETF = 13U,
/* Legacy PAL 625-line EOTF */
/** Legacy PAL 625-line EOTF */
KHR_DF_TRANSFER_PAL625_EOTF = 14U,
/* Legacy ST240 transfer function */
/** Legacy ST240 transfer function */
KHR_DF_TRANSFER_ST240 = 15U,
/* ACEScc transfer function */
/** ACEScc transfer function */
KHR_DF_TRANSFER_ACESCC = 16U,
/* ACEScct transfer function */
/** ACEScct transfer function */
KHR_DF_TRANSFER_ACESCCT = 17U,
/* Adobe RGB (1998) transfer function */
/** Adobe RGB (1998) transfer function */
KHR_DF_TRANSFER_ADOBERGB = 18U,
KHR_DF_TRANSFER_MAX = 0xFFU
} khr_df_transfer_e;
Expand Down
Loading
Loading