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

Fix crash when glBlendEquation is missing #2814

Open
wants to merge 1 commit into
base: 2.6.x
Choose a base branch
from

Conversation

Zombieschannel
Copy link

Description

Fix to this issue: #2462

image

Basically, I noticed that the Galaxy S22 Exynos crashes when running any SFML apps, and it seems like it does not have the glBlendEquation extension, SFML does not check whether it has it or not, it just tries to use it, resulting in a crash. Adding an else if statement fixes this.

Tasks

  • Tested on Linux
  • Tested on Windows
  • Tested on macOS
  • Tested on iOS
  • Tested on Android

@ChrisThrasher
Copy link
Member

Do you know why this seemingly modern phone doesn't support this feature?

Is it fine to simply do nothing when this GL feature is not present? Do we need a new else block that does some fallback behavior for devices without this feature?

@Zombieschannel
Copy link
Author

Zombieschannel commented Dec 5, 2023

Do you know why this seemingly modern phone doesn't support this feature?

I have no idea, but I mentioned my theory in #2462 under My conclusion:

Is it fine to simply do nothing when this GL feature is not present?

Since it is an extension, I don't think it will have any impact on rendering (other than the fact that changing the blend equation won't do anything). I guess I could add a warning saying that it is missing from the device.

Do we need a new else block that does some fallback behavior for devices without this feature?

I don't think there is anything special that can be done if this function is missing. It is included in GLES 2.0+.

@binary1248
Copy link
Member

It is pretty clear from the OES_blend_subtract and EXT_blend_minmax extension specifications that the function has to be available. The fact that the system advertises support but doesn't return the corresponding function pointer is a bug in the implementation of the driver.

Working around this problem by just silently doing nothing isn't really a favourable solution. Because blending support is pretty standard I assume that blending is supported, just not under that function pointer. Core OpenGL ES also provides blending under glBlendEquation. Maybe this function is available although glBlendEquationOES isn't. Can you check whether this is the case?

Also, a list of supported extensions and more information about the context (version, type etc.) would be helpful.

@Zombieschannel
Copy link
Author

So here are the results: https://opengles.gpuinfo.org/displayreport.php?id=6660
And yes, EXT_blend_minmax seems to be available.
Also this function is mentioned:
image

@Zombieschannel
Copy link
Author

Interestingly, EXT_blend_minmax mentions this:

Dependencies on OpenGL ES
If the GL is OpenGL ES, only the new MIN_EXT and MAX_EXT blend equations
are introduced by this extension. BlendEquationOES, FUNC_ADD_OES, and
BLEND_EQUATION_OES are introduced by the OES_blend_subtract extension,
which is required for this extension to operate. Alternatively,
OpenGL ES 2.0 is required, which introduces BlendEquation, FUNC_ADD, and
BLEND_EQUATION without the suffixes.

OES_blend_subtract doesn't seem to be supported, could this be the issue?

@binary1248
Copy link
Member

In the gpuinfo report your provided, it seems like all < OpenGL ES 3.0 extensions were removed since their functionality was merged into the core specification. Can you check what version the context is that SFML creates on your system?

@Zombieschannel
Copy link
Author

I'm not sure how could I check that. Since if I use 2.6, I'll get that created version 0.0 error, and if I use SFML 3, I'll get that "defaulting to 1.1" as mentioned here: #2438

@binary1248
Copy link
Member

Based on your gpuinfo, the GL_VERSION string should be OpenGL ES 3.2 ANGLE git hash: 50101db6df97, so I really don't understand how the version query in SFML can fail as you described unless context creation itself fails in some way and prevents us from getting any function pointers. Can you try creating a context and getting its version with the current master revision of SFML?

@Zombieschannel
Copy link
Author

So when using SFML from master, window.getSettings().majorVersion and minorVersion return 0 0 for some reason. I thought it was fixed a few months ago. Anyways, using glGetString() with GL_VERSION GL_RENDERER GL_VENDOR GL_EXTENSIONS I got the data I provided in the txt. Hopefully these are now the GLES 1 extensions.

glesdata.txt

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.

None yet

3 participants