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

Betsy: Implement BC4 compression #97295

Merged
merged 1 commit into from
Oct 14, 2024
Merged

Conversation

BlueCube3310
Copy link
Contributor

@BlueCube3310 BlueCube3310 commented Sep 21, 2024

Adds support for BC4 / ATI1 / RGTC_R compression to Betsy. This is a prerequisite for BC3/BC5, since they use a separate BC4 block for storing their uncorrelated alpha and green channels respectively.
In terms of performance, it is comparable to etcpak.

TODO:

  • Add a testing project,
  • Document the changes.

Future work:

  • Add BC3 and BC5,
  • Convert RGB-RGBA on the GPU,
  • Optimize mipmap compression,

MRP: betsyrgtcr.zip

@BlueCube3310 BlueCube3310 force-pushed the betsy-bc4 branch 2 times, most recently from 4ccdfeb to bd00d2e Compare September 21, 2024 20:45
@BlueCube3310 BlueCube3310 marked this pull request as ready for review September 22, 2024 09:09
@BlueCube3310 BlueCube3310 requested review from a team as code owners September 22, 2024 09:09
@AThousandShips AThousandShips added this to the 4.x milestone Sep 22, 2024
@fire
Copy link
Member

fire commented Sep 22, 2024

@Calinou How do I queue this to run on the benchmark servers? Also can you take a look?

Copy link
Member

@clayjohn clayjohn 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!

@clayjohn clayjohn modified the milestones: 4.x, 4.4 Oct 12, 2024
@Calinou
Copy link
Member

Calinou commented Oct 12, 2024

How do you get a texture to import as BC4 in Godot? I've tried to import a grayscale PNG and a RGB PNG that only has a red channel (green/blue are fully black as confirmed in GIMP). However, both are imported as DXT1 with VRAM compression or BPTC RGBA with high-quality enabled (neither have an alpha channel).

test_vram_red_grayscale.zip

@BlueCube3310
Copy link
Contributor Author

How do you get a texture to import as BC4 in Godot? I've tried to import a grayscale PNG and a RGB PNG that only has a red channel (green/blue are fully black as confirmed in GIMP). However, both are imported as DXT1 with VRAM compression or BPTC RGBA with high-quality enabled (neither have an alpha channel).

test_vram_red_grayscale.zip

BC4 only works with red only images with the channel packing set to optimized

@Repiteo Repiteo merged commit a1e768c into godotengine:master Oct 14, 2024
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 14, 2024

Thanks!

@BlueCube3310 BlueCube3310 deleted the betsy-bc4 branch November 28, 2024 20:19
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.

6 participants