diff --git a/build.rs b/build.rs index a8dddc4..bc6e728 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,3 @@ -extern crate gl_generator; - use std::env; use std::fs::File; use std::path::PathBuf; diff --git a/src/draw_buffer.rs b/src/draw_buffer.rs index 7d46606..4e59142 100644 --- a/src/draw_buffer.rs +++ b/src/draw_buffer.rs @@ -38,7 +38,7 @@ impl ColorAttachment { } } - fn destroy(self, gl: &gl::Gl) { + fn destroy(self, gl: &dyn gl::Gl) { match self { ColorAttachment::Renderbuffer(id) => gl.delete_renderbuffers(&[id]), ColorAttachment::Texture(tex_id) => gl.delete_textures(&[tex_id]), @@ -52,7 +52,7 @@ impl ColorAttachment { /// packed or independent depth or stencil buffers, /// depending on context requirements. pub struct DrawBuffer { - gl_: Rc, + gl_: Rc, size: Size2D, framebuffer: GLuint, color_attachment: Option, @@ -65,7 +65,7 @@ pub struct DrawBuffer { /// Helper function to create a render buffer /// TODO(emilio): We'll need to switch between `glRenderbufferStorage` and /// `glRenderbufferStorageMultisample` when we support antialising -fn create_renderbuffer(gl_: &gl::Gl, +fn create_renderbuffer(gl_: &dyn gl::Gl, format: GLenum, size: &Size2D) -> GLuint { let ret = gl_.gen_renderbuffers(1)[0]; @@ -159,7 +159,7 @@ impl DrawBuffer { } } - fn gl(&self) -> &gl::Gl { + fn gl(&self) -> &dyn gl::Gl { &*self.gl_ } diff --git a/src/gl_context.rs b/src/gl_context.rs index c14c598..487ccd2 100644 --- a/src/gl_context.rs +++ b/src/gl_context.rs @@ -13,7 +13,7 @@ use crate::ColorAttachmentType; /// This is a wrapper over a native headless GL context pub struct GLContext { - gl_: Rc, + gl_: Rc, native_context: Native, /// This an abstraction over a custom framebuffer /// with attachments according to WebGLContextAttributes @@ -41,7 +41,7 @@ impl GLContext pub fn create_shared_with_dispatcher(api_type: &gl::GlType, api_version: GLVersion, shared_with: Option<&Native::Handle>, - dispatcher: Option>) + dispatcher: Option>) -> Result { let native_context = Native::create_shared_with_dispatcher(shared_with, api_type, @@ -102,7 +102,7 @@ impl GLContext api_type: gl::GlType, api_version: GLVersion, shared_with: Option<&Native::Handle>, - dispatcher: Option>) + dispatcher: Option>) -> Result { // We create a headless context with a dummy size, we're painting to the // draw_buffer's framebuffer anyways. @@ -163,11 +163,11 @@ impl GLContext self.native_context.handle() } - pub fn gl(&self) -> &gl::Gl { + pub fn gl(&self) -> &dyn gl::Gl { &*self.gl_ } - pub fn clone_gl(&self) -> Rc { + pub fn clone_gl(&self) -> Rc { self.gl_.clone() } @@ -242,7 +242,7 @@ impl GLContext Ok(()) } - fn query_extensions(gl_: &Rc, api_version: GLVersion) -> Vec { + fn query_extensions(gl_: &Rc, api_version: GLVersion) -> Vec { if api_version.major_version() >=3 { // glGetString(GL_EXTENSIONS) is deprecated on OpenGL >= 3.x. // Some GL backends such as CGL generate INVALID_ENUM error when used. @@ -289,5 +289,5 @@ impl GLVersion { // Right now it's used in the WGL implementation to dispatch functions to the thread // where the context we share from is bound. See the WGL implementation for more details. pub trait GLContextDispatcher { - fn dispatch(&self, f: Box); + fn dispatch(&self, f: Box); } diff --git a/src/gl_limits.rs b/src/gl_limits.rs index 5dbfb37..05277aa 100644 --- a/src/gl_limits.rs +++ b/src/gl_limits.rs @@ -65,7 +65,7 @@ macro_rules! gl_integer { } } -fn gl_fallible_integer(gl_: &gl::Gl, pname: gl::GLenum) -> Result { +fn gl_fallible_integer(gl_: &dyn gl::Gl, pname: gl::GLenum) -> Result { let mut val = [0]; unsafe { gl_.get_integer_v(pname, &mut val); @@ -79,7 +79,7 @@ fn gl_fallible_integer(gl_: &gl::Gl, pname: gl::GLenum) -> Result { } impl GLLimits { - pub fn detect(gl_: &gl::Gl) -> GLLimits { + pub fn detect(gl_: &dyn gl::Gl) -> GLLimits { let max_vertex_attribs = gl_integer!(gl_, MAX_VERTEX_ATTRIBS); let max_tex_size = gl_integer!(gl_, MAX_TEXTURE_SIZE); let max_cube_map_tex_size = gl_integer!(gl_, MAX_CUBE_MAP_TEXTURE_SIZE); diff --git a/src/lib.rs b/src/lib.rs index 5766a45..45e1fd8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,6 @@ #[macro_use] extern crate log; -#[cfg(feature="serde")] -extern crate serde; - #[cfg(any(not(target_os = "linux"), feature = "test_egl_in_linux"))] #[macro_use] extern crate lazy_static; diff --git a/src/platform/mod.rs b/src/platform/mod.rs index bc20c86..52559e9 100644 --- a/src/platform/mod.rs +++ b/src/platform/mod.rs @@ -17,7 +17,7 @@ pub trait NativeGLContextMethods: Sized { fn create_shared_with_dispatcher(with: Option<&Self::Handle>, api_type: &gl::GlType, api_version: GLVersion, - _dispatcher: Option>) + _dispatcher: Option>) -> Result { Self::create_shared(with, api_type, api_version) }