GLideNHQ: zstd compression for texture cache#2969
Conversation
There was a problem hiding this comment.
It's the equivalent to libpng.a and libz.a.
There was a problem hiding this comment.
Ok. I supposed that it should be system, but some platforms really use .a libs from GLideNHQ/lib folder.
I already forgot these details :(
I just tried to configure QT build with -system-zlib |
The conflict still exists. You can confirm this by creating a cache file using a build from this PR, then trying to load that exact cache file with GLideN64 built from master. If the HD textures load on the master build, then the cache file is compressed with I assume some of the symbols are kicked out during the compilation process, as a "proper" build of GLideN64 with zstd fully working is larger than one where the conflict kicked in: If we can't get around that |
|
I'll build QT without -qt-zlib and check if it breaks anything. But not today, it is 0:28 AM already. |
Done, but it didn't solve the problem. However, it was tricky, but I built QT libs with -system-zlib. @GhostlyDark please check that zstd compression really works with the updated QT libs. |
Yes, it works with the updated QT prebuilts as intended. |
Supersedes #2960. Based on #2968 (may want to merge that one first).
Compared to the previous PR, this is based on the vcpkg introduction and gets rid of the
zstd.candzstd.hsource files.We still have to deal with the zlib symbol conflicts as it stands, so recompiling the Qt5 binaries is a must (with
-system-zlibinstead of-qt-zlibduring configure step). I am unfortunately still very much unable to get things to compile, but binary edited theQt5Core.libto "fix" the symbol conflicts for thezstd_testbranch of my fork, with the edited Qt5 prebuilt uploaded there. From my testing, this does not cause any regressions and can be confirmed using the builds here:https://github.com/GhostlyDark/GLideN64/actions/runs/27233155351
Note that I didn't touch the debug
Qt5Cored.libfiles as CI isn't using it and Qt5 should preferably be recompiled anyway.This adds zstd compression support by using a
zlibWrapperto support bothzlibandzstdcompression streams.Closes #2913.
Initial size comparisons (HTS cache) for OoT Reloaded texture pack:
uncompressed:
28.5 GB (30.694.669.834 bytes)zlib-level1:
8.28 GB (8 897 605 579 bytes)zstd-level1:
8.69 GB (9 334 399 841 bytes)zstd-level9:
6.80 GB (7 307 463 076 bytes)Do note that
level9in this case is just thelevel9compression level ofzlibtranslated by the wrapper, not the actualzstdcompression level (which ranges up to 22).An HTS file using
zstdoutperforms anyzlibcompressed one, reducing stutter quite noticeably. I did however notice that uncompressed cache files still perform better (tested on a RAMDisk to rule out drive speed bottlenecks). ThezlibWrappercauses some overhead, so the wrapper itself introduces a performance degradation that otherwise wouldn't be there (unknown by how much exactly). It should be possible to use the zstd API directly instead, which would involve recognizing the correct compression format and handling the zstd compression with new code - something I don't feel comfortable tackling myself at the time of writing.Numbers from the zstd repo, which I believe to be somewhat accurate:
