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

[Issue] Font Display Letters partially corrupted. #913

Open
Langerz82 opened this issue Aug 29, 2024 · 1 comment
Open

[Issue] Font Display Letters partially corrupted. #913

Langerz82 opened this issue Aug 29, 2024 · 1 comment

Comments

@Langerz82
Copy link

Version: Somewhat modified ES - https://github.com/EmuELEC/emuelec-emulationstation
Built with OPENGLES 2.0.

Child Issue:
EmuELEC/EmuELEC#878

When the user plays a game, and ES halts upon resume some of the font letters have pixel corruption around some of the sides.

I've isolated it down to this function:
void Font::getTextureForNewGlyph(const Vector2i& glyphSize, FontTexture*& tex_out, Vector2i& cursor_out)
https://github.com/Aloshi/EmulationStation/blob/master/es-core/src/resources/Font.cpp#L324

If Texture Cacheing is disabled, the fonts display perfectly, but I think it also cause a memory-leak lool as my system crashed.

By making the pixel spacing between cache texture fonts = 2, it minimizes the amount of corruption but its still present.
https://github.com/Aloshi/EmulationStation/blob/master/es-core/src/resources/Font.cpp#L276
https://github.com/Aloshi/EmulationStation/blob/master/es-core/src/resources/Font.cpp#L288

I'm at a loss how to fix the issue, and hopefully the ES team can shed some light on how to fix this issue.
Thanks guys, I hope the report is detailed enough.

@Langerz82
Copy link
Author

Langerz82 commented Aug 29, 2024

Think I worked it out:
When it creates the texture here:
https://github.com/EmuELEC/emuelec-emulationstation/blob/EmuELEC/es-core/src/renderers/Renderer_GLES20.cpp#L631C31-L631C44

For GLES20:
passing nullptr into the data does not actually initialise all the data to empty, resulting in leftover artifacts. By creating memory and setting it all to 0xFF for luminance alpha, and 0x0 for just alpha, it nows displays fontface lettering correct.
https://github.com/EmuELEC/emuelec-emulationstation/blob/EmuELEC/es-core/src/renderers/Renderer_GLES20.cpp#L669C4-L669C94
https://github.com/EmuELEC/emuelec-emulationstation/blob/EmuELEC/es-core/src/renderers/Renderer_GLES20.cpp#L683

Here is my solution in EmuELEC's emulationstation, but I'm sure you can incorporate it for a proper fix in your code:
https://github.com/EmuELEC/emuelec-emulationstation/pull/100/files <-- edit: updated link.

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

1 participant