-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #2529 - servo:angle-wrench, r=nical
Add ANGLE rendering in Wrench The `--angle` command-line parameter enables it on Windows, when `--headless` is not also used. It panics on non-Windows. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2529) <!-- Reviewable:end -->
- Loading branch information
Showing
7 changed files
with
761 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
use glutin; | ||
use glutin::{WindowBuilder, ContextBuilder, EventsLoop, Window, CreationError}; | ||
|
||
#[cfg(not(windows))] | ||
pub enum Context {} | ||
|
||
#[cfg(windows)] | ||
pub use ::egl::Context; | ||
|
||
impl Context { | ||
#[cfg(not(windows))] | ||
pub fn with_window( | ||
_: WindowBuilder, | ||
_: ContextBuilder, | ||
_: &EventsLoop, | ||
) -> Result<(Window, Self), CreationError> { | ||
Err(CreationError::PlatformSpecific("ANGLE rendering is only supported on Windows".into())) | ||
} | ||
|
||
#[cfg(windows)] | ||
pub fn with_window( | ||
window_builder: WindowBuilder, | ||
context_builder: ContextBuilder, | ||
events_loop: &EventsLoop, | ||
) -> Result<(Window, Self), CreationError> { | ||
use glutin::os::windows::WindowExt; | ||
|
||
// FIXME: &context_builder.pf_reqs https://github.com/tomaka/glutin/pull/1002 | ||
let pf_reqs = &glutin::PixelFormatRequirements::default(); | ||
let gl_attr = &context_builder.gl_attr.map_sharing(|_| unimplemented!()); | ||
let window = window_builder.build(events_loop)?; | ||
Self::new(pf_reqs, gl_attr) | ||
.and_then(|p| p.finish(window.get_hwnd() as _)) | ||
.map(|context| (window, context)) | ||
} | ||
} | ||
|
||
#[cfg(not(windows))] | ||
impl glutin::GlContext for Context { | ||
unsafe fn make_current(&self) -> Result<(), glutin::ContextError> { | ||
match *self {} | ||
} | ||
|
||
fn is_current(&self) -> bool { | ||
match *self {} | ||
} | ||
|
||
fn get_proc_address(&self, _: &str) -> *const () { | ||
match *self {} | ||
} | ||
|
||
fn swap_buffers(&self) -> Result<(), glutin::ContextError> { | ||
match *self {} | ||
} | ||
|
||
fn get_api(&self) -> glutin::Api { | ||
match *self {} | ||
} | ||
|
||
fn get_pixel_format(&self) -> glutin::PixelFormat { | ||
match *self {} | ||
} | ||
|
||
fn resize(&self, _: u32, _: u32) { | ||
match *self {} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.