Skip to content

[Experimental] Add Betsy GPU texture compressor#91150

Closed
BlueCube3310 wants to merge 1 commit into
godotengine:masterfrom
BlueCube3310:betsy-gpu-compressor
Closed

[Experimental] Add Betsy GPU texture compressor#91150
BlueCube3310 wants to merge 1 commit into
godotengine:masterfrom
BlueCube3310:betsy-gpu-compressor

Conversation

@BlueCube3310

@BlueCube3310 BlueCube3310 commented Apr 25, 2024

Copy link
Copy Markdown
Contributor

A proof-of-concept implementation of the Betsy GPU texture compressor. Currently, the only supported formats are BC1 and BC6.

In terms of performance it is comparable to etcpak, albeit the results are significantly higher-quality, especially with BC1.

TODO:

  • Add all other formats currently supported by Betsy,
  • Look into BC7 and ASTC,
  • Improve the parallelization of the process. Currently each mip map is compressed one after another, ideally they should all be compressed concurrently and combined at the end,
  • Clean up the code,
  • Get some insight from someone with more knowledge about compute shaders whether I'm doing this correctly,
  • Find a way to speed up RGB to RGBA texture conversion (RGB formats cannot be sampled directly),
  • Use the default static methods in Image instead of rd-specific variants,
  • Some of the shader code was modified, ideally it should be reverted to how it is in upstream,
  • Test on a lot of different GPUs,
  • Move the thirdparty files into the thirdparty directory,
  • Fix memory leaks.

@fire

fire commented Apr 25, 2024

Copy link
Copy Markdown
Member

Hooray! I will review as I can.

@fire fire requested a review from a team April 25, 2024 12:49
@fire

fire commented Apr 25, 2024

Copy link
Copy Markdown
Member

Can you rebase to master and apply the pre-commit run -a to format the code?

@BlueCube3310 BlueCube3310 force-pushed the betsy-gpu-compressor branch 2 times, most recently from 6e5255a to cbd65f4 Compare April 25, 2024 17:29
Comment thread modules/betsy/bc1.glsl Outdated

@fire fire Apr 25, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@akien-mga What's the policy on things like a glsl compute shader from Betsy. Normally it should go in the thirdparty but maybe you've got other suggestions.

Comment thread core/io/image.cpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We tend to remove commented code. It is also unclear if betsy will have ASTC support in the short term.

Comment thread thirdparty/README.md Outdated
@BlueCube3310 BlueCube3310 force-pushed the betsy-gpu-compressor branch from e8ceeb5 to de6ea0c Compare April 28, 2024 12:41
@lyuma

lyuma commented May 3, 2024

Copy link
Copy Markdown
Contributor

In asset meeting: we should focus on getting this in for BC6H for light maps

@BlueCube3310

Copy link
Copy Markdown
Contributor Author

In asset meeting: we should focus on getting this in for BC6H for light maps

BC6 support is pretty much finished, it just needs testing. I think I'm going to make a separate PR which only implements that format so it can be merged early on for 4.4, while this one with a full integration can be merged later.

@BlueCube3310

Copy link
Copy Markdown
Contributor Author

Closing as this is superseded by #91535 and #95915

@AThousandShips AThousandShips removed this from the 4.x milestone Sep 7, 2024
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.

4 participants