mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
servo/main: Load gl symbols in headless mode
This allows running WebGL reftests in wpt.
This commit is contained in:
parent
35473b0009
commit
938a05428a
3 changed files with 20 additions and 0 deletions
1
components/servo/Cargo.lock
generated
1
components/servo/Cargo.lock
generated
|
@ -24,6 +24,7 @@ dependencies = [
|
|||
"net 0.0.1",
|
||||
"net_tests 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
|
||||
"profile 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"script 0.0.1",
|
||||
|
|
|
@ -133,6 +133,9 @@ features = ["plugins"]
|
|||
[dependencies.gleam]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.offscreen_gl_context]
|
||||
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.3"
|
||||
time = "0.1.12"
|
||||
|
|
|
@ -29,12 +29,25 @@ extern crate log;
|
|||
extern crate servo;
|
||||
extern crate time;
|
||||
|
||||
extern crate gleam;
|
||||
extern crate offscreen_gl_context;
|
||||
|
||||
use gleam::gl;
|
||||
use offscreen_gl_context::GLContext;
|
||||
use servo::Browser;
|
||||
use servo::compositing::windowing::WindowEvent;
|
||||
use servo::net_traits::hosts;
|
||||
use servo::util::opts;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn load_gl_when_headless() {
|
||||
gl::load_with(|addr| GLContext::get_proc_address(addr) as *const _);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
fn load_gl_when_headless() {}
|
||||
|
||||
fn main() {
|
||||
env_logger::init().unwrap();
|
||||
|
||||
|
@ -47,6 +60,9 @@ fn main() {
|
|||
hosts::global_init();
|
||||
|
||||
let window = if opts::get().headless {
|
||||
// Load gl functions even when in headless mode,
|
||||
// to avoid crashing with webgl
|
||||
load_gl_when_headless();
|
||||
None
|
||||
} else {
|
||||
Some(app::create_window(std::ptr::null_mut()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue