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 shared EGL Context creation faliure on some Android GPUs #105

Merged
merged 1 commit into from
Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "offscreen_gl_context"
license = "MIT / Apache-2.0"
version = "0.11.0"
version = "0.11.1"
authors = ["Emilio Cobos Álvarez <[email protected]>", "The Servo Project Developers"]
description = "Creation and manipulation of HW accelerated offscreen rendering contexts in multiple platforms. Originally intended for the Servo project's WebGL implementation."
repository = "https://github.com/emilio/rust-offscreen-rendering-context"
Expand Down
13 changes: 12 additions & 1 deletion src/platform/with_egl/native_gl_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,18 @@ impl NativeGLContext {
egl::NONE as EGLint, 0, 0, 0, // see mod.rs
];

let ctx = unsafe { egl::CreateContext(display, config, shared, attributes.as_ptr()) };
let mut ctx = unsafe { egl::CreateContext(display, config, shared, attributes.as_ptr()) };

if share_context.is_some() && ctx == (egl::NO_CONTEXT as EGLContext) {
// Workaround for GPUs that don't like different CONTEXT_CLIENT_VERSION value when sharing (e.g. Mali-T880).
// Set CONTEXT_CLIENT_VERSION 3 to fix the shared ctx creation failure. Note that the ctx is still OpenGL ES 2.0
// compliant because egl::OPENGL_ES2_BIT is set for egl::RENDERABLE_TYPE. See utils.rs.
let attributes = [
egl::CONTEXT_CLIENT_VERSION as EGLint, 3,
egl::NONE as EGLint, 0, 0, 0, // see mod.rs
];
ctx = unsafe { egl::CreateContext(display, config, shared, attributes.as_ptr()) };
}

// TODO: Check for every type of error possible, not just client error?
// Note if we do it we must do it too on egl::CreatePBufferSurface, etc...
Expand Down