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

PixelFormat::R8/A8 and GLES 2.0 #1829

Closed
smilediver opened this issue Apr 17, 2024 · 5 comments · Fixed by #1839
Closed

PixelFormat::R8/A8 and GLES 2.0 #1829

smilediver opened this issue Apr 17, 2024 · 5 comments · Fixed by #1839
Labels
enhancement New feature or request
Milestone

Comments

@smilediver
Copy link
Contributor

GLES 2.0 for single channel textures used PixelFormat::A8, but in GLES 3.0 it was removed in favor of PixelFormat::R8. It seems like all other graphics APIs also use PixelFormat::R8. Our and Axmol code is full of hacks like these:

auto pixelFormat = AX_GLES_PROFILE == 200 ? PixelFormat::A8 : PixelFormat::R8;

Maybe it's worth to make PixelFormat::A8 = PixelFormat::R8 and deal with the difference on the backend side when calling GLES api, so all code could use PixelFormat::R8 everywhere? I'm not aware of unintended consequences, but at first sight it seems it would work. There could also be a macro to help on the shader code side, something like:

#ifdef GLES2
    #define R8_CHANNEL a
#else
    #define R8_CHANNEL r
#endif

What do you think?

@aismann
Copy link
Contributor

aismann commented Apr 17, 2024

@smilediver
I found only 3 times like you means:

image

@aismann
Copy link
Contributor

aismann commented Apr 18, 2024

Our ... code is full of hacks like these:

auto pixelFormat = AX_GLES_PROFILE == 200 ? PixelFormat::A8 : PixelFormat::R8;

@smilediver
May a "global pixelFormat" member is the solution on your code, defined only one times?
Can you close this issue?

@smilediver
Copy link
Contributor Author

I would prefer for this to be handled on the engine side, since the engine's whole purpose is to abstract out such minor platform differences. But if people don't see this as something useful, then I'll close the issue.

@aismann
Copy link
Contributor

aismann commented Apr 18, 2024

@halx99 @rh101
What are you meaning?

@halx99 halx99 added this to the 2.1.3 milestone Apr 19, 2024
@halx99 halx99 added the enhancement New feature or request label Apr 19, 2024
@halx99 halx99 linked a pull request Apr 19, 2024 that will close this issue
6 tasks
@halx99
Copy link
Collaborator

halx99 commented Apr 20, 2024

Can by done #1839 and GLES2 will emulate R8 RG8 via:

  • R8: L8
  • RG8: LA8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants