godot icon indicating copy to clipboard operation
godot copied to clipboard

[Experimental] Add Betsy GPU texture compressor

Open BlueCube3310 opened this issue 1 year ago • 2 comments

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.

BlueCube3310 avatar Apr 25 '24 11:04 BlueCube3310

Hooray! I will review as I can.

fire avatar Apr 25 '24 12:04 fire

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

fire avatar Apr 25 '24 15:04 fire

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

lyuma avatar May 03 '24 16:05 lyuma

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 avatar May 03 '24 19:05 BlueCube3310

Closing as this is superseded by #91535 and #95915

BlueCube3310 avatar Sep 07 '24 09:09 BlueCube3310