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

Resolve GLES 2 crash on older iOS devices #27071

Merged
merged 2 commits into from Mar 16, 2019

Conversation

Projects
None yet
2 participants
@samgreen
Copy link
Member

commented Mar 14, 2019

This resolves #26450.

Since both types EAGLContext exists and are valid to create on some devices, the export template would always create a GL ES 3 context, which was causing FBO crashes when the rest of the pipeline was configured as OpenGL ES 2.

// WARNING: We must *always* create the GLView after we have constructed the
// OS with iphone_main. This allows the GLView to access project settings so
// it can properly initialize the OpenGL context
GLView *glView = [[GLView alloc] initWithFrame:rect];

This comment has been minimized.

Copy link
@samgreen

samgreen Mar 14, 2019

Author Member

This ordering is critical now since we’re using GLOBAL_GET in initGLES

Add logging around opengl es context creation. Ensure we can access p…
…roject settings prior to creating our gl es context, so we can properly determine which driver to use.

@samgreen samgreen force-pushed the samgreen:ios_gles2_fix branch 2 times, most recently from b57d03a to 57a1884 Mar 14, 2019

@samgreen

This comment has been minimized.

Copy link
Member Author

commented Mar 15, 2019

Tested the fallback code and it seems to be working appropriately. Relevant console log:

With the fallback:

2019-03-14 18:49:13.564022-0700 GLES2Export[732:97998] Setting up an OpenGL ES 3 context. Based on Project Settings "rendering/quality/driver/driver_name"
2019-03-14 18:49:18.993945-0700 GLES2Export[732:97998] Failed to created OpenGL ES 3 context. Falling back to OpenGL ES 2.
2019-03-14 18:49:26.106476-0700 GLES2Export[732:97998] Setting up an OpenGL ES 2 context. 
2019-03-14 18:50:04.980086-0700 GLES2Export[732:97998] OpenGL ES 2.0 Renderer: Apple A8 GPU

With a GL ES 2 forced:

2019-03-14 18:54:51.293350-0700 GLES2Export[746:99196] Setting up an OpenGL ES 2 context.
2019-03-14 18:54:51.341819-0700 GLES2Export[746:99196] OpenGL ES 2.0 Renderer: Apple A8 GPU

With a GL ES 3 device:

2019-03-14 18:53:18.560944-0700 GLES2Export[739:98736] Setting up an OpenGL ES 3 context. Based on Project Settings "rendering/quality/driver/driver_name"
2019-03-14 18:53:18.629171-0700 GLES2Export[739:98736] OpenGL ES 3.0 Renderer: Apple A8 GPU

@samgreen samgreen force-pushed the samgreen:ios_gles2_fix branch from 57a1884 to f05211b Mar 15, 2019

return nil;
}
if (![self createFramebuffer]) {
NSLog(@"Failed to create frame buffer!");

This comment has been minimized.

Copy link
@samgreen

samgreen Mar 15, 2019

Author Member

Hopefully the verbosity of these NSLog statements should save us from headaches in the future.

Show resolved Hide resolved platform/iphone/gl_view.mm Outdated
@akien-mga

This comment has been minimized.

Copy link
Member

commented Mar 15, 2019

Looks great, thank you! Just needs a typo fix and I'll merge (please amend the commit).

@samgreen

This comment has been minimized.

Copy link
Member Author

commented Mar 15, 2019

Will get this amended today. Thanks!

@samgreen samgreen force-pushed the samgreen:ios_gles2_fix branch from f05211b to 0eeab29 Mar 16, 2019

@samgreen

This comment has been minimized.

Copy link
Member Author

commented Mar 16, 2019

Rebased and fixed the typos in an amended commit.

Show resolved Hide resolved platform/iphone/gl_view.mm Outdated
Show resolved Hide resolved platform/iphone/gl_view.mm Outdated
Show resolved Hide resolved platform/iphone/gl_view.mm Outdated
Show resolved Hide resolved platform/iphone/gl_view.mm Outdated

@samgreen samgreen force-pushed the samgreen:ios_gles2_fix branch from 0eeab29 to 5ba016a Mar 16, 2019

@samgreen samgreen force-pushed the samgreen:ios_gles2_fix branch from 5ba016a to 4946335 Mar 16, 2019

@akien-mga

This comment has been minimized.

Copy link
Member

commented Mar 16, 2019

Thanks!

@akien-mga akien-mga merged commit b00c96a into godotengine:master Mar 16, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@akien-mga

This comment has been minimized.

Copy link
Member

commented Mar 16, 2019

Cherry-picked for 3.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.