mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #22856 - jdm:angle, r=paulrouget
Add optional ANGLE support to glutin port Supporting ANGLE in Servo has two important benefits: * we can actually run Servo instances on our Windows CI machines, which gives us more confidence that we're not breaking it * we can continue to use OpenGL on devices like the Hololens, rather than creating platform-specific graphical backends <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22856) <!-- Reviewable:end -->
This commit is contained in:
commit
b1b47d8046
9 changed files with 63 additions and 25 deletions
|
@ -66,6 +66,7 @@ sig = "1.0"
|
|||
x11 = "2.0.0"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
mozangle = { version = "0.2", features = ["egl"] }
|
||||
winapi = { version = "0.3", features = ["wingdi", "winuser"] }
|
||||
|
||||
[target.'cfg(any(target_os = "macos", all(target_arch = "x86_64", target_os = "linux")))'.dependencies]
|
||||
|
|
|
@ -184,12 +184,13 @@ fn get_default_url() -> ServoUrl {
|
|||
cmdline_url.or(pref_url).or(blank_url).unwrap()
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
|
||||
pub fn gl_version() -> glutin::GlRequest {
|
||||
glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 2))
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
pub fn gl_version() -> glutin::GlRequest {
|
||||
glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (3, 0))
|
||||
if opts::get().angle {
|
||||
glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (3, 0))
|
||||
} else {
|
||||
glutin::GlRequest::GlThenGles {
|
||||
opengl_version: (3, 2),
|
||||
opengles_version: (3, 0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use glutin::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
|
|||
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
|
||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||
use glutin::Icon;
|
||||
use glutin::{ContextBuilder, GlContext, GlWindow};
|
||||
use glutin::{Api, ContextBuilder, GlContext, GlWindow};
|
||||
use glutin::{ElementState, KeyboardInput, MouseButton, MouseScrollDelta, TouchPhase};
|
||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||
use image;
|
||||
|
@ -145,13 +145,14 @@ impl Window {
|
|||
|
||||
glutin_window.show();
|
||||
|
||||
let gl = match gl::GlType::default() {
|
||||
gl::GlType::Gl => unsafe {
|
||||
let gl = match glutin_window.context().get_api() {
|
||||
Api::OpenGl => unsafe {
|
||||
gl::GlFns::load_with(|s| glutin_window.get_proc_address(s) as *const _)
|
||||
},
|
||||
gl::GlType::Gles => unsafe {
|
||||
Api::OpenGlEs => unsafe {
|
||||
gl::GlesFns::load_with(|s| glutin_window.get_proc_address(s) as *const _)
|
||||
},
|
||||
Api::WebGl => unreachable!("webgl is unsupported"),
|
||||
};
|
||||
|
||||
gl.clear_color(0.6, 0.6, 0.6, 1.0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue