Allow user to choose between GL and ES2

This commit is contained in:
Prashant Gupta 2015-12-02 13:40:08 -05:00 committed by Josh Matthews
parent 0f526054eb
commit 4899611864
5 changed files with 70 additions and 36 deletions

22
ports/cef/Cargo.lock generated
View file

@ -15,7 +15,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -147,7 +147,7 @@ dependencies = [
"gfx_traits 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -167,7 +167,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -256,7 +256,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout_traits 0.0.1",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -609,7 +609,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -645,7 +645,7 @@ dependencies = [
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1",
"plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -695,7 +695,7 @@ dependencies = [
"compositing 0.0.1",
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1",
"net_traits 0.0.1",
"script_traits 0.0.1",
@ -920,8 +920,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "layers"
version = "0.2.2"
source = "git+https://github.com/servo/rust-layers#dd28dbee88fa18cfe416403d59e9c74c7299d7ab"
version = "0.2.4"
source = "git+https://github.com/servo/rust-layers#3cb5df49d7f069eea1f1f0550921c5833cb5bc7f"
dependencies = [
"azure 0.4.3 (git+https://github.com/servo/rust-azure)",
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1152,7 +1152,7 @@ dependencies = [
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1684,7 +1684,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -33,7 +33,7 @@ use style_traits::cursor::Cursor;
use url::Url;
use util::geometry::ScreenPx;
#[cfg(feature = "window")]
use util::opts;
use util::opts::{self, RenderApi};
#[cfg(feature = "window")]
static mut g_nested_event_loop_listener: Option<*mut (NestedEventLoopListener + 'static)> = None;
@ -157,9 +157,15 @@ impl Window {
#[cfg(not(target_os = "android"))]
fn gl_version() -> GlRequest {
if opts::get().use_webrender {
GlRequest::Specific(Api::OpenGl, (3, 2))
} else {
GlRequest::Specific(Api::OpenGl, (2, 1))
return GlRequest::Specific(Api::OpenGl, (3, 2));
}
match opts::get().render_api {
RenderApi::GL => {
GlRequest::Specific(Api::OpenGl, (2, 1))
}
RenderApi::ES2 => {
GlRequest::Specific(Api::OpenGlEs, (2, 0))
}
}
}
@ -672,7 +678,14 @@ impl WindowMethods for Window {
fn native_display(&self) -> NativeDisplay {
use x11::xlib;
unsafe {
NativeDisplay::new(self.window.platform_display() as *mut xlib::Display)
match opts::get().render_api {
RenderApi::GL => {
NativeDisplay::new(self.window.platform_display() as *mut xlib::Display)
},
RenderApi::ES2 => {
NativeDisplay::new_egl_display()
}
}
}
}

20
ports/gonk/Cargo.lock generated
View file

@ -9,7 +9,7 @@ dependencies = [
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -140,7 +140,7 @@ dependencies = [
"gfx_traits 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -160,7 +160,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -249,7 +249,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout_traits 0.0.1",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -612,7 +612,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -648,7 +648,7 @@ dependencies = [
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1",
"plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -902,8 +902,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "layers"
version = "0.2.2"
source = "git+https://github.com/servo/rust-layers#dd28dbee88fa18cfe416403d59e9c74c7299d7ab"
version = "0.2.4"
source = "git+https://github.com/servo/rust-layers#3cb5df49d7f069eea1f1f0550921c5833cb5bc7f"
dependencies = [
"azure 0.4.3 (git+https://github.com/servo/rust-azure)",
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1134,7 +1134,7 @@ dependencies = [
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1665,7 +1665,7 @@ dependencies = [
"gfx 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)",
"layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",