Skip to content
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

Decode BasisU textures to BCn format instead of RGBA8 #474

Merged
merged 7 commits into from
Oct 4, 2023

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Oct 2, 2023

Fixes #266

Previously, compressed textures were decoded to RGBA8 instead of the native BCn format due to a limitation in Kit 105.0. Now with Kit 105.1 we can decode to BCn and keep the data compressed on the GPU. This involves a bit of a strange workaround with the stride parameter (see comments in the code).

Test data:

agi-ktx2-explicit.zip
agi-ktx.usda.zip

@lilleyse lilleyse enabled auto-merge October 3, 2023 19:10
@lilleyse
Copy link
Contributor Author

lilleyse commented Oct 3, 2023

I confirmed that the texture memory is lower because of this change. See the Texture - Other category. It's a small difference (112 MB - 101 MB), but I think it's because there's other textures being counted in that stat and the initial view doesn't load many tiles. I ran multiple runs and get the same result.

Before After
before after

Copy link
Contributor

@weegeekps weegeekps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question but otherwise looks good.

@@ -637,6 +641,15 @@ const pxr::TfToken& Context::getCesiumMdlPathToken() const {
return _cesiumMdlPathToken;
}

bool Context::isCompressedTexturesSupported() const {
// Compressed textures do not work in Kit 105.0 or 105.0.1
if (_kitVersion.rfind("105.0", 0) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this even necessary? We just released version 0.11.0 which claims that versions less than 105.1 are unsupported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good point... I'll remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I worked on this PR before realizing that 0.11.0 wouldn't be backwards compatible with Kit 105.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case do we even need any of the code to pass the kit version up to the native layer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I just removed it all

@lilleyse lilleyse disabled auto-merge October 3, 2023 23:12
@lilleyse lilleyse enabled auto-merge October 3, 2023 23:13
Copy link
Contributor

@weegeekps weegeekps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and works great.

@lilleyse lilleyse merged commit 4ed7cc6 into main Oct 4, 2023
3 checks passed
@lilleyse lilleyse deleted the compressed-textures branch October 4, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for compressed textures and mipmaps
2 participants