1400 Commits

Author SHA1 Message Date
Rich Geldreich
9bebe16726 Merge pull request #458 from vkedwardli/fix/netbsd
Fix float overload deduction on NetBSD
2026-07-22 14:36:49 -04:00
Rich Geldreich
5f6a0a0ca6 Merge pull request #463 from BinomialLLC/fix-ktx2-level-uncomp-msg
KTX2: fix wrong error message for oversized level uncompressed length
2026-07-18 22:28:39 -04:00
Richard Geldreich
28ab277db8 KTX2: fix wrong error message for oversized level uncompressed length
The sanity check on a level's m_uncompressed_byte_length (>= 2 GiB)
logged "Invalid level offset (too large)", which names the wrong field.
Correct it to "Invalid level uncompressed byte length (too large)".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 22:24:57 -04:00
Rich Geldreich
d77f9308e2 Merge pull request #462 from BinomialLLC/webgl-build-clean-slow
webgl/build.sh: run make clean on --clean, add --slow serial option
2026-07-18 19:45:32 -04:00
Richard Geldreich
018cc67cd0 webgl: add --slow option to build.sh for a serial build
--slow uses `make -j1` (one file at a time, the classic manual `make`)
instead of the default `make -j$(nproc)`. Useful for readable output or
constrained machines; parallel remains the default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 19:37:52 -04:00
Richard Geldreich
b512234dff webgl: build.sh --clean runs 'make clean' before wiping the CMake cache
For a more thorough clean, --clean now runs `make clean` (removing the
build outputs and object files via the existing build system) before
deleting CMakeCache.txt/CMakeFiles and reconfiguring.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 19:33:48 -04:00
Rich Geldreich
edfa1fc3a4 Merge pull request #461 from BinomialLLC/ktx2-init-range-checks
webgl: add build.sh to build the transcoder/encoder
2026-07-18 19:15:31 -04:00
Richard Geldreich
fcab97d371 webgl: add build.sh to build the transcoder/encoder with Emscripten
Convenience script (place: webgl/build.sh) that runs emcmake/cmake/make
in webgl/transcoder/build and webgl/encoder/build. Stops on the first
error (set -euo pipefail), builds both by default or a named target
(transcoder/encoder), supports --clean and -D... cmake pass-through, is
runnable from any directory, and auto-sources emsdk if emcmake is not on
PATH.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 19:05:54 -04:00
Rich Geldreich
368e2a5122 Merge pull request #460 from BinomialLLC/ktx2-init-range-checks
previewers: free rgbBuf with free() instead of delete
2026-07-18 18:55:48 -04:00
Richard Geldreich
3b0017e677 previewers: free rgbBuf with free() instead of delete
BasisThumbProvider::GetThumbnail() allocates rgbBuf with malloc() but
freed it with delete, which is a mismatched-allocator (and delete on a
void*) undefined behavior. Use free() to match the allocation, as is
already done for the sibling 'data' buffer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 18:38:36 -04:00
Rich Geldreich
399927dc36 Merge pull request #459 from BinomialLLC/ktx2-init-range-checks
Ktx2 init range checks
2026-07-18 18:18:14 -04:00
Richard Geldreich
38168767f4 rebuilt artifacts 2026-07-18 18:11:39 -04:00
Richard Geldreich
57a0a0b4c6 previewers: regenerate single-file transcoder with KTX2/Zstd enabled
Regenerate contrib/previewers/lib/basisu_transcoder.cpp from the current
transcoder sources with the single_file_transcoder combine.py script,
replacing a long-stale copy. KTX2 and Zstd are enabled.

Only the Basis Universal sources are amalgamated; Zstd is kept as an
ordinary #include "../zstd/zstd.h" (via combine.py's -k option) rather
than being inlined, and zstd/zstd.c is compiled and linked separately,
so Zstd is neither touched nor duplicated.

Update the previewers project to build the current (C++17) transcoder:
- set LanguageStandard to stdcpp17 (the transcoder uses inline variables
  and other C++17 features);
- define NOMINMAX (the Windows shell headers, included before the
  transcoder, otherwise define min/max macros that break the
  std::numeric_limits<>::max() calls);
- add the zstd directory to the include paths and compile
  ..\..\..\zstd\zstd.c as a separate compilation unit.

The DLL builds for Debug/Release, x64 and Win32. The previewer still
only registers .basis files; enabling KTX2/Zstd just makes the
transcoder compile cleanly out of the box.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 17:59:57 -04:00
Richard Geldreich
f2497f14d6 KTX2 transcoder: build with BASISD_SUPPORT_KTX2 disabled
Two things prevented the transcoder from compiling with
BASISD_SUPPORT_KTX2 set to 0:

- ktx2_image_level_info was defined inside the #if BASISD_SUPPORT_KTX2
  block, but dds_transcoder::get_image_level_info() takes it by
  reference and is compiled unconditionally. Move the struct ahead of
  that block so it is always defined; it has no KTX2-specific members.

- The "#include ../zstd/zstd.h" was nested inside #if BASISD_SUPPORT_KTX2,
  but the Zstd decompressor (zstd_decompress()) is compiled whenever
  BASISD_SUPPORT_KTX2_ZSTD is set, independent of KTX2 (Zstd is also used
  by other codecs). With KTX2 off but Zstd on, the ZSTD_* symbols were
  referenced without the header being included. Gate the include on
  BASISD_SUPPORT_KTX2_ZSTD alone, matching where the symbols are used.

BASISD_SUPPORT_KTX2_ZSTD still defaults to 1 (unchanged). The default
build (KTX2 and Zstd both enabled) is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 17:20:38 -04:00
Richard Geldreich
3454230543 KTX2: overflow-safe range checks and input bounds in ktx2_transcoder::init
The KTX2 level and supercompression-global-data (SGD) offset/length
fields are full 64-bit values read from the file. init() validated them
with "offset + length > m_data_size", where the addition can wrap around
and incorrectly pass for out-of-range values. Rewrite both checks as
"offset > m_data_size || length > (uint64_t)m_data_size - offset", which
cannot overflow (offset is confirmed <= m_data_size before the
subtraction, so it can't underflow either). The result is identical to
the original for every in-range input.

Also in init():
- Reject a level whose byte_length is 0. This case already logged an
  error but fell through without returning false.
- Add KTX2_MAX_SUPPORTED_LAYER_COUNT (65535) and reject files whose
  layer_count exceeds it, mirroring KTX2_MAX_SUPPORTED_LEVEL_COUNT, so
  layer_count * face_count * level_count stays bounded.

read_slice_offset_len_global_data(): compute image_count in 64-bit,
verify m_sgd_byte_length == image_count * descriptor_size before sizing
the descriptor array, and use try_resize() (returns false on failure)
instead of resize() (which aborts the process) so an out-of-range count
fails cleanly instead of attempting an oversized allocation. Also
compute image_count in 64-bit in decompress_etc1s_global_data().

Valid files are handled exactly as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-18 16:47:58 -04:00
Edward Li
6546e407eb Fix float overload deduction on NetBSD 2026-07-14 22:01:58 +08:00
Richard Geldreich
1b33fd5098 Adding Cache-Control to dev web server to disable browser caching 2026-07-05 21:38:40 -04:00
Richard Geldreich
0f540010c5 adding channel weights comment 2026-07-05 21:37:48 -04:00
Richard Geldreich
20ed781c4b updating comment 2026-07-03 23:01:13 -04:00
Richard Geldreich
dc86b2cdbf comment fix 2026-07-03 22:51:04 -04:00
Richard Geldreich
fc3a67a5c0 comment fix 2026-07-03 22:45:41 -04:00
Richard Geldreich
a73f8b80ed rebuilt 2026-07-03 22:18:21 -04:00
Richard Geldreich
b0c0216d7e per-channel weight parameter rename (discovered during documentation pass) 2026-07-03 22:13:18 -04:00
Richard Geldreich
984978bb2c updating per-channel weight comment 2026-07-03 22:12:26 -04:00
Richard Geldreich
bbc49c63a8 rebuild artifact 2026-07-03 22:09:46 -04:00
Richard Geldreich
079b0129ee updating comment for set_srgb_options() 2026-07-03 22:05:48 -04:00
Richard Geldreich
fecef375e7 Compression parameter rename: renaming m_xuastc_ldr_channel_weights[] to m_ldr_channel_weights[] (it's no longer XUASTC/ASTC specific, it's also used for XUBC7 and DDS creation) 2026-07-03 22:03:05 -04:00
Richard Geldreich
b50b394845 adding set_ldr_srgb_channel_weights() compression parameter API (it's no longer XUASTC/ASTC specific) 2026-07-03 21:40:00 -04:00
Richard Geldreich
e79d46aadd rebuilt artifacts 2026-07-03 02:17:29 -04:00
Richard Geldreich
0857faf8d7 changing the GL base internal format for BC6H to be RGB not RGBA 2026-07-03 02:06:10 -04:00
Richard Geldreich
0442737aa7 deblocking comment update 2026-07-02 23:14:30 -04:00
Richard Geldreich
306ff5f951 minor change 2026-07-02 22:55:40 -04:00
Richard Geldreich
1743668373 adding D3D 11 shader deblocking sample (a port of the native OpenGL version) 2026-07-02 22:52:05 -04:00
Richard Geldreich
2ac3126841 rebuilt artifacts 2026-07-02 04:20:51 -04:00
Richard Geldreich
f99e343c00 code fix found via AI audit 2026-07-02 04:11:58 -04:00
Richard Geldreich
929f80198d fixing comments 2026-07-02 01:32:34 -04:00
Richard Geldreich
2de810cd71 Merge remote-tracking branch 'origin/master' 2026-07-01 23:43:02 -04:00
Richard Geldreich
069e065454 formatting fix 2026-07-01 23:43:00 -04:00
Rich Geldreich
1105886f56 Update README.md 2026-07-01 15:52:22 -04:00
Rich Geldreich
7dbf3308eb Update README.md 2026-07-01 15:50:42 -04:00
Rich Geldreich
11f4bf8a14 Update README.md 2026-07-01 15:49:17 -04:00
Rich Geldreich
a27c30c964 Update README.md 2026-07-01 15:46:43 -04:00
Rich Geldreich
0e4cd3e4e5 Update NOTICE 2026-07-01 15:45:14 -04:00
Richard Geldreich
37b08e0a5b Merge remote-tracking branch 'origin/master' 2026-07-01 15:10:13 -04:00
Richard Geldreich
bfa665aa26 rebuilt artifacts 2026-07-01 15:10:10 -04:00
Rich Geldreich
f6a7da5532 Update README.md 2026-07-01 15:04:15 -04:00
Rich Geldreich
4de7c43634 Update README.md 2026-07-01 15:03:38 -04:00
Rich Geldreich
7ba9f36875 Update README.md 2026-07-01 14:52:07 -04:00
Rich Geldreich
c5e05d088e Update README to include DDS transcoding support
Added a new section on DDS transcoding support, detailing the capabilities of the transcoder module in version 2.5.
2026-07-01 14:51:05 -04:00
Rich Geldreich
02b43c874f Update README.md 2026-07-01 14:49:52 -04:00