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

iOS Simulator with opengles3 backend does not render due to glBlitFramebuffer returning GL_INVALID_FRAMEBUFFER_OPERATION #82917

Closed
migueldeicaza opened this issue Oct 6, 2023 · 6 comments · Fixed by #84955

Comments

@migueldeicaza
Copy link
Contributor

migueldeicaza commented Oct 6, 2023

Godot version

4.1 branch, commit 399c9dc

System information

macOS Ventura on M2 Mac, running Xcode 15.0, iOS simulator, GLES3

Issue description

When attempting to use Godot 4.1 with the iOS simulator (also happens on master as of this writing), I resorted to using the OpenGLES3 due to Vulkan not working (#74227). But this version fails to work as the call to glBlitFramebuffer called from RasterizerGLES3::_blit_render_target_to_screen returns GL_INVALID_FRAMEBUFFER_OPERATION

According to the OpenGLES3 documentation:

GL_INVALID_FRAMEBUFFER_OPERATION is generated if the specified read and draw framebuffers are not framebuffer complete.

While searching for similar issues, I found that some years ago work was done in this area as well (#20006), and I attempted to force the use of use_depth_prepass on Apple, but this did not have any effect.

I added a call to:

glCheckFramebufferStatus(GL_FRAMEBUFFER)

And this returns GL_FRAMEBUFFER_UNDEFINED, documented as:

GL_FRAMEBUFFER_UNDEFINED is returned if target is the default framebuffer, but the default framebuffer does not exist.

Some stack overflow answers from a long time ago seem to indicate that maybe the iOS view is not correctly setup.

Steps to reproduce

Export the attached project to iOS (but any project will trigger this).

Minimal reproduction project

demo.tar.gz

@clayjohn
Copy link
Member

clayjohn commented Oct 6, 2023

It looks like glCheckFramebufferStatus(GL_FRAMEBUFFER) is equivalent to glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER), which does indicate that this is an issue with the iOS view

CC @bruvzg Who knows more about how we create the iOS view

@varuntecholution
Copy link

I'll look into this issue on my Mac M1

@migueldeicaza
Copy link
Contributor Author

I do not speak enough OpenGL to do justice to what @kisg mentioned at GodotCon, but it goes something like this:

Apparently some core OpenGL buffer is getting destroyed accidentally, he mentioned that this was a small patch.

@kisg
Copy link
Contributor

kisg commented Nov 11, 2023

We will send in the PR in the next days, should be still in time for 4.2.

@kisg
Copy link
Contributor

kisg commented Nov 16, 2023

Opened PR with the patch: #84955

@migueldeicaza
Copy link
Contributor Author

Thank you so much! This is wonderful @kisg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants