-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - KTX2/DDS/.basis compressed texture support #3884
Conversation
7f01cff
to
fa574dc
Compare
{ | ||
return Err(TextureError::FormatRequiresTranscodingError( | ||
TranscodeFormat::Rgb8, | ||
)); |
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.
Maybe an error is a strange way to communicate this but...
3ee589d
to
c06b81d
Compare
I've looked this over some more and gone through to remove/address a bunch of FIXMEs I'd left. I changed my mind and now I'm thinking that it's better to just get this in rather than being overly careful. It's better that people start using it and we iterate rather than letting perfect be the enemy of good. |
Then I guess RenderDevice will not be available and this will panic? Maybe they should be changed back to |
Although, this will basically mean that there will be no compressed texture support on Android and WebGPU and that isn't acceptable. So this is just something that needs to be solved. I tried to look into if the loader can be mutated after initialisation, but then I realised that that wouldn't work as it could allow attempts to load assets before enough information is available to do so. Some things have to wait until the renderer is initialised. How exactly we do that, I don't know. |
the async plugin story in Bevy is not great for now, it sounds like we will need to work on it to have compressed texture support everywhere |
Yes, and it feels like it is outside the scope of this PR. |
By the way, I didn't do the blanket matches so it was easy to see what formats there were in the library and which were supported and not, by looking at the code. I'm fine with it either way though. |
I think I'd prefer to bias toward smaller code + eliminate redundancies. People that want to add new formats will know what they're looking for and can look at the enum definitions / docs to find out if its supported. |
(but thanks for the heads up. thats definitely a reasonable approach and I probably should have discussed it before making the change) |
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.
This looks good to me. This supports like a million permutations of texture types, so I can't really test that it works. But this feels like a "let people yell at us if we did something wrong" sort of situation.
bors r+ |
# Objective - Support compressed textures including 'universal' formats (ETC1S, UASTC) and transcoding of them to - Support `.dds`, `.ktx2`, and `.basis` files ## Solution - Fixes #3608 Look there for more details. - Note that the functionality is all enabled through non-default features. If it is desirable to enable some by default, I can do that. - The `basis-universal` crate, used for `.basis` file support and for transcoding, is built on bindings against a C++ library. It's not feasible to rewrite in Rust in a short amount of time. There are no Rust alternatives of which I am aware and it's specialised code. In its current state it doesn't support the wasm target, but I don't know for sure. However, it is possible to build the upstream C++ library with emscripten, so there is perhaps a way to add support for web too with some shenanigans. - There's no support for transcoding from BasisLZ/ETC1S in KTX2 files as it was quite non-trivial to implement and didn't feel important given people could use `.basis` files for ETC1S.
Woohoo! |
# Objective - Support compressed textures including 'universal' formats (ETC1S, UASTC) and transcoding of them to - Support `.dds`, `.ktx2`, and `.basis` files ## Solution - Fixes bevyengine#3608 Look there for more details. - Note that the functionality is all enabled through non-default features. If it is desirable to enable some by default, I can do that. - The `basis-universal` crate, used for `.basis` file support and for transcoding, is built on bindings against a C++ library. It's not feasible to rewrite in Rust in a short amount of time. There are no Rust alternatives of which I am aware and it's specialised code. In its current state it doesn't support the wasm target, but I don't know for sure. However, it is possible to build the upstream C++ library with emscripten, so there is perhaps a way to add support for web too with some shenanigans. - There's no support for transcoding from BasisLZ/ETC1S in KTX2 files as it was quite non-trivial to implement and didn't feel important given people could use `.basis` files for ETC1S.
# Objective - Support compressed textures including 'universal' formats (ETC1S, UASTC) and transcoding of them to - Support `.dds`, `.ktx2`, and `.basis` files ## Solution - Fixes bevyengine#3608 Look there for more details. - Note that the functionality is all enabled through non-default features. If it is desirable to enable some by default, I can do that. - The `basis-universal` crate, used for `.basis` file support and for transcoding, is built on bindings against a C++ library. It's not feasible to rewrite in Rust in a short amount of time. There are no Rust alternatives of which I am aware and it's specialised code. In its current state it doesn't support the wasm target, but I don't know for sure. However, it is possible to build the upstream C++ library with emscripten, so there is perhaps a way to add support for web too with some shenanigans. - There's no support for transcoding from BasisLZ/ETC1S in KTX2 files as it was quite non-trivial to implement and didn't feel important given people could use `.basis` files for ETC1S.
Objective
.dds
,.ktx2
, and.basis
filesSolution
basis-universal
crate, used for.basis
file support and for transcoding, is built on bindings against a C++ library. It's not feasible to rewrite in Rust in a short amount of time. There are no Rust alternatives of which I am aware and it's specialised code. In its current state it doesn't support the wasm target, but I don't know for sure. However, it is possible to build the upstream C++ library with emscripten, so there is perhaps a way to add support for web too with some shenanigans..basis
files for ETC1S.