Skip to content

DDS texture support in texture replacer #17083

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
merged 4 commits into from
Mar 11, 2023
Merged

DDS texture support in texture replacer #17083

merged 4 commits into from
Mar 11, 2023

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Mar 9, 2023

Supports the various BC formats that can be stored in a DDS file, single mipmap only for now (will be extended later).

Work-in-progress, currently only works with Vulkan.

@hrydgard hrydgard added this to the v1.15.0 milestone Mar 9, 2023
@hrydgard
Copy link
Owner Author

hrydgard commented Mar 11, 2023

Reworked this again. Still only works in Vulkan, will add DDS support for the other ones later, possibly.

Next step will be to load multiple mipmaps from the same file, which will take some refactoring. After that, will try to add support to the other backends, as much as possible. Then once raw block compressed format loading is working, will add support for additional formats like KTX, Basis, UASTC, haven't chosen yet.

TODO: BC7 format isn't yet working.

@hrydgard hrydgard marked this pull request as ready for review March 11, 2023 11:34
@hrydgard hrydgard merged commit f32d0c2 into master Mar 11, 2023
@hrydgard hrydgard deleted the dds-support branch March 11, 2023 11:52
Comment on lines +458 to +460
if (actualFmt != VULKAN_8888_FORMAT) {
actualFmt = actualFmt;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something must be wrong here. Should one of these sides be dstFmt?

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

Uh I don't know what happened here, might be some kind of copy paste mistake. I'll clean it up in some near future commit.

Comment on lines +1553 to +1554
default:
break;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Spaces lost in a bustling world of tabs.

-[Unknown]

Comment on lines +534 to +535
// TODO: Add sanity checks here for other formats?
// Just gonna do a memcpy, slightly scared of the parallel ones.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It may cause some contention but it should be fine for large amounts of data. If the game is showing one large 512x512 texture as a background, and it's upscaled to 2048x2048, the parallel is likely to be worth it. At most, could adjust the heuristics on when.

It would mostly not be worth it if we had a ton of textures to load and it starved them.

-[Unknown]

Copy link
Owner Author

@hrydgard hrydgard Mar 12, 2023

Choose a reason for hiding this comment

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

Fair enough, but with the compressed texture formats, the data size is drastically smaller, 0.5 or 1 byte per pixel instead of four. But yeah, I'll have another look at the heuristics and probably activate here too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's still very likely worth it for copying 2MB (0.5 of 2048x2048.) Ideal might be to only use a few threads for it, but especially on a device with 12+ threads, it's practically wasting them not to...

-[Unknown]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants