-
Notifications
You must be signed in to change notification settings - Fork 59
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
Ktximporter: forward Basis Universal compressed images to BasisImporter #113
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TODO: tests
TODO: tests, docs
If zstd can't be found by FindBasisUniversal.cmake, compile with Zstandard (de)compression support disabled. At runtime, detect this and print a useful error (instead of "transcoding failed").
This sets the correct basis parameters depending on the image format. Can still be overridden by config values, if present. TODO tests
Array layers, cube faces and z slices are imported in an extra image dimension, ie. Image3D. Image type is exposed via texture(). TODO tests, docs, some extra validation on .basis files
basisu doesn't do it for us, only in .basis files
Removed from the basisu C++ API, can be replaced by swizzle=rrrg
basisu doesn't flip level 1 or higher
All mipmaps in basis are 2D, but they'd need to halve in Z for correct 3D mipmaps. Print a warning and import them as 2D array textures with mipmaps instead.
because transcoding all frames at once is probably a stupid idea. We also catch any attempt to seek ahead as an error, since basis doesn't allow seeking (all but the first image are P-frames).
…s Verbose is set No test because I don't know how to reliably redirect stdout. There's still no way to redirect basis output to custom sinks.
…on, second attempt
# Conflicts: # src/MagnumPlugins/BasisImporter/BasisImporter.cpp # src/MagnumPlugins/BasisImporter/Test/BasisImporterTest.cpp
This is way too broken
…empt WSL is amazingly helpful for this
it requires CMake 3.7
and test the converted image, not the original(??) image
G is taken from the alpha channel, matching the recommended basisu -swizzle rrrg for two channels. We don't control this, it's done by the transcoder.
…eir own This fixes the use case of feeding an RG image + swizzle rrrg (as recommended by the basis docs). This would lead to the output becoming rrrr since BasisImageConverter already performed that swizzle. Also document the behaviour.
Config options and flags are propagated to an internal instance of BasisImporter. All functions are then proxied to that internal instance until this instance is closed.
pezcode
force-pushed
the
ktximporter-forward-basis
branch
from
October 29, 2021 15:26
b79faaa
to
8ed0621
Compare
Closed
Merged as 6fbb0b8...cefedba. Sorry for the long delays with everything, to avoid delaying even further with another round of reviews, I pushed this directly with a few things done differently:
Thank you for completing this huge chunk of work! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #112. Only the two most recent commits are relevant, since this is on top of #112 to make sure the tests pass on CI.
If KtxImporter finds a file compressed with Basis Universal (either through BasisLZ supercompression, or a Basis UASTC format in the DFD), it transparently proxies to an internal instance of
BasisImporter
. Flags and config options are propagated, I shamelessly copied that fromAnyImageImporter
🤠Possible Todos
openData()
is called withDataFlag::Owned
, there's currently no way to forward this to another importer, incurring a needless copy. A fix would depend on Zero-copy importer plugin APIs magnum#240Related issue: #110.