-
-
Notifications
You must be signed in to change notification settings - Fork 22.4k
basis_universal: Update to 1.60 #103968
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
basis_universal: Update to 1.60 #103968
Conversation
7d72c9a
to
f34056e
Compare
f34056e
to
246b062
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with https://polyhaven.com/a/cambridge (8192x4096, 13 mipmaps, compression = BasisUniversal):
4.4-stable | This PR |
---|---|
16.5s | 4.2s |
The encoding process is about 4x faster. I wasn't able to spot any regressions in terms of quality either
Can you help upstream? This is non blocking for approving this pr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected.
Benchmark
PC specifications
- CPU: Intel Core i9-13900K
- GPU: NVIDIA GeForce RTX 4090
- RAM: 64 GB (2×32 GB DDR5-5800 C30)
- SSD: Solidigm P44 Pro 2 TB
- OS: Linux (Fedora 42)
Using an optimized editor build (production=yes lto=full
). BasisU encode times for https://polyhaven.com/a/cambridge in .hdr
format with Basis Universal compression (mipmap generation disabled):
1K | 2K | 4K | 8K | 16K | 17K* | |
---|---|---|---|---|---|---|
master |
143 ms | 622 ms | 2282 ms | 9563 ms | 9406 ms | 36502 ms |
This PR | 37 ms | 166 ms | 645 ms | 2488 ms | 7845 ms | 10158 ms |
*: While testing this, I noticed the downscaling logic has an issue (at least with HDRIs or Basis Universal compression). The 17K HDRI will be downsized to 16K, but the resulting texture is pure black. This occurs both before and after this PR.
WARNING: res://cambridge_17k.hdr: Texture was downsized on import as its width (17858 pixels) exceeded the importable size limit (16384 pixels).
at: import (./editor/import/resource_importer_texture.cpp:599)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thirdparty code integration wise, this looks good to me.
This one would be worth PR'ing upstream too. |
Got a PR that'll fix the CI issue, #105756 |
Thanks! |
After this was merged the patches in It makes rebasing my current PR on master which touches the same code difficult. |
The problem seems to be the "illegal character" patch, which is not cross-platform. It likely works on Windows but fails for me on Linux. |
Due to the update changing a plethora of things, here's a recap:
modules/basis_universal/image_compress_basisu.cpp
libktx
makes use of the bundledbasis_universal
library, I had to change the type of one variable, as seen inthirdparty/libktx/patches/0003-basisu-1.60.patch
(new patch forlibktx
)thirdparty/basis_universal/encoder/basisu_astc_hdr_6x6_enc.h
, which is a new file, had a superscript two symbol in a comment - this is all good and nice, but due to, I guess, UTF-8 non-complience, it generated a warning that was treated as an error by one Windows CI job; I changed the symbol to^2
, as seen inthirdparty/basis_universal/patches/0005-windows-illegal-character.patch
(also see: Change²
(U+00B2) to^2
BinomialLLC/basis_universal#394)clang
sanitizers didn't like the ambiguity of1ULL
, as it could be treated as a 32-bit or a 64-bit integer, due to an implicit conversion; patched inthirdparty/basis_universal/patches/0006-ambiguous-calls.patch
(also see: Fix ambiguous calls tosafe_shift_left()
inbasisu_containers.h
BinomialLLC/basis_universal#387)jpeg_decoder
flags had to be added inthirdparty/basis_universal/patches/0002-external-jpgd.patch
Speaking of patches, wouldn't simply prepending function bodies in
thirdparty/basis_universal/patches/0004-remove-tinydds-qoi.patch
withreturn false;
be an easier change that achieves the same result? Or would something in the build system throw a tantrum over unreachable code?