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

RGBA vs BGRA #32

Open
BastiaanOlij opened this issue Dec 1, 2022 · 4 comments
Open

RGBA vs BGRA #32

BastiaanOlij opened this issue Dec 1, 2022 · 4 comments

Comments

@BastiaanOlij
Copy link

Hi,

I'm trying to figure out an issue that we're having where it seems that the ETC compression routines are expecting BGRA input. I'm not ruling out that we are doing something wrong later on in the pipeline and assuming the decompressed image is in BGRA format and thus resulting in it displaying wrong.

Can you confirm whether CompressEtc2Rgb and CompressEtc2Rgba expect data in BGRA format?

Cheers,

Bas

@wolfpld
Copy link
Owner

wolfpld commented Dec 1, 2022

I don't remember. If it fixes things for you, then it is probably what's required. You can verify by following the PNG decode path, which explicitly calls something related to bgra conversion (quite unnecessarily, but it's too ingrained into the code now).

@BastiaanOlij
Copy link
Author

BastiaanOlij commented Dec 1, 2022

Thanks @wolfpld , I guess the question here is, is ETC internally BGRA? Ergo when we supply RGBA data, does ETCPAK convert it to BGRA and save it as such?

I have a suspicion that us loading ETC data and then telling the GPU the data is RGBA, that this is actually where it goes wrong, not in saving, and us flipping the R and B channels on save just works around the issue. Is there any place to find good info on this?

edit hmm, no thats probably not it, we're using VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK so you'd assume Vulkan is treating the data as RGBA

@wolfpld
Copy link
Owner

wolfpld commented Dec 2, 2022

There is only one way to decode the ETC data (i.e. transform the ETC binary stream into vec4 RGBA fields in shaders). Only input data to etcpak matters.

@BastiaanOlij
Copy link
Author

Then i am happy that our changes in Godot are doing the right thing, does then indeed seem to be the input to ProcessRGB(A) is BGRA.

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

No branches or pull requests

2 participants