Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gleam"
version = "0.11.0"
version = "0.12.0"
license = "Apache-2.0/MIT"
authors = ["The Servo Project Developers"]
build = "build.rs"
Expand All @@ -9,4 +9,5 @@ repository = "https://github.com/servo/gleam"
description = "Generated OpenGL bindings and wrapper for Servo."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to bump the version number.


[build-dependencies]
gl_generator = "0.14"
#gl_generator = "0.14"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to remove this before merging, once upstream is published

gl_generator = { git = "https://github.com/brendanzab/gl-rs/", rev = "1cd256c7b59a0baac8af7863ca0f768bfc1a4b51" }
16 changes: 9 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ fn main() {
"GL_APPLE_fence",
"GL_APPLE_texture_range",
"GL_APPLE_vertex_array_object",
"GL_ARB_base_instance",
"GL_ARB_blend_func_extended",
"GL_ARB_copy_image",
"GL_ARB_get_program_binary",
Expand All @@ -43,24 +44,25 @@ fn main() {

// GLES 3.0 bindings
let gles_extensions = [
"GL_ANGLE_base_vertex_base_instance",
"GL_ANGLE_copy_texture_3d",
"GL_ANGLE_provoking_vertex",
"GL_ANGLE_texture_usage",
"GL_CHROMIUM_copy_texture",
"GL_EXT_copy_image",
"GL_EXT_debug_marker",
"GL_EXT_disjoint_timer_query",
"GL_EXT_shader_pixel_local_storage",
"GL_EXT_shader_texture_lod",
"GL_EXT_texture_filter_anisotropic",
"GL_EXT_texture_format_BGRA8888",
"GL_EXT_texture_storage",
"GL_OES_EGL_image_external",
"GL_OES_EGL_image",
"GL_OES_EGL_image_external",
"GL_OES_texture_half_float",
"GL_EXT_shader_pixel_local_storage",
"GL_ANGLE_provoking_vertex",
"GL_ANGLE_texture_usage",
"GL_CHROMIUM_copy_texture",
"GL_KHR_debug",
"GL_KHR_blend_equation_advanced",
"GL_KHR_blend_equation_advanced_coherent",
"GL_ANGLE_copy_texture_3d",
"GL_KHR_debug",
];
let gles_reg = Registry::new(
Api::Gles2,
Expand Down
32 changes: 32 additions & 0 deletions src/gl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,20 @@ declare_gl_apis! {
first: GLint,
count: GLsizei,
primcount: GLsizei);
// GL_ARB_base_instance
fn draw_arrays_instanced_base_instance(&self,
mode: GLenum,
first: GLint,
count: GLsizei,
instance_count: GLsizei,
base_instance: GLuint);
// GL_ANGLE_base_vertex_base_instance
fn draw_arrays_instanced_base_instance_angle(&self,
mode: GLenum,
first: GLint,
count: GLsizei,
instance_count: GLsizei,
base_instance: GLuint);
fn draw_elements(&self,
mode: GLenum,
count: GLsizei,
Expand All @@ -457,6 +471,24 @@ declare_gl_apis! {
element_type: GLenum,
indices_offset: GLuint,
primcount: GLsizei);
// GL_ARB_base_instance
fn draw_elements_instanced_base_instance(&self,
mode: GLenum,
count: GLsizei,
element_type: GLenum,
indices_offset: GLuint,
instance_count: GLsizei,
base_instance: GLuint);
// GL_ANGLE_base_vertex_base_instance
fn draw_elements_instanced_base_vertex_base_instance_angle(&self,
mode: GLenum,
count: GLsizei,
element_type: GLenum,
indices_offset: GLuint,
instance_count: GLsizei,
base_vertex: GLsizei,
base_instance: GLuint);

fn blend_color(&self, r: f32, g: f32, b: f32, a: f32);
fn blend_func(&self, sfactor: GLenum, dfactor: GLenum);
fn blend_func_separate(&self,
Expand Down
68 changes: 63 additions & 5 deletions src/gl_fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ impl Gl for GlFns {

fn draw_arrays(&self, mode: GLenum, first: GLint, count: GLsizei) {
unsafe {
return self.ffi_gl_.DrawArrays(mode, first, count);
self.ffi_gl_.DrawArrays(mode, first, count);
}
}

Expand All @@ -1168,12 +1168,36 @@ impl Gl for GlFns {
primcount: GLsizei,
) {
unsafe {
return self
.ffi_gl_
self.ffi_gl_
.DrawArraysInstanced(mode, first, count, primcount);
}
}

fn draw_arrays_instanced_base_instance(
&self,
mode: GLenum,
first: GLint,
count: GLsizei,
instance_count: GLsizei,
base_instance: GLuint,
) {
unsafe {
self.ffi_gl_
.DrawArraysInstancedBaseInstance(mode, first, count, instance_count, base_instance);
}
}

fn draw_arrays_instanced_base_instance_angle(
&self,
_: GLenum,
_: GLint,
_: GLsizei,
_: GLsizei,
_: GLuint,
) {
unimplemented!()
}

fn draw_elements(
&self,
mode: GLenum,
Expand All @@ -1182,7 +1206,7 @@ impl Gl for GlFns {
indices_offset: GLuint,
) {
unsafe {
return self.ffi_gl_.DrawElements(
self.ffi_gl_.DrawElements(
mode,
count,
element_type,
Expand All @@ -1200,7 +1224,7 @@ impl Gl for GlFns {
primcount: GLsizei,
) {
unsafe {
return self.ffi_gl_.DrawElementsInstanced(
self.ffi_gl_.DrawElementsInstanced(
mode,
count,
element_type,
Expand All @@ -1210,6 +1234,40 @@ impl Gl for GlFns {
}
}

fn draw_elements_instanced_base_instance(
&self,
mode: GLenum,
count: GLsizei,
element_type: GLenum,
indices_offset: GLuint,
instance_count: GLsizei,
base_instance: GLuint,
) {
unsafe {
self.ffi_gl_.DrawElementsInstancedBaseInstance(
mode,
count,
element_type,
indices_offset as *const c_void,
instance_count,
base_instance,
);
}
}

fn draw_elements_instanced_base_vertex_base_instance_angle(
&self,
_: GLenum,
_: GLsizei,
_: GLenum,
_: GLuint,
_: GLsizei,
_: GLsizei,
_: GLuint,
) {
unimplemented!()
}

fn blend_color(&self, r: f32, g: f32, b: f32, a: f32) {
unsafe {
self.ffi_gl_.BlendColor(r, g, b, a);
Expand Down
77 changes: 72 additions & 5 deletions src/gles_fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ impl Gl for GlesFns {

fn draw_arrays(&self, mode: GLenum, first: GLint, count: GLsizei) {
unsafe {
return self.ffi_gl_.DrawArrays(mode, first, count);
self.ffi_gl_.DrawArrays(mode, first, count);
}
}

Expand All @@ -1171,12 +1171,36 @@ impl Gl for GlesFns {
primcount: GLsizei,
) {
unsafe {
return self
.ffi_gl_
self.ffi_gl_
.DrawArraysInstanced(mode, first, count, primcount);
}
}

fn draw_arrays_instanced_base_instance(
&self,
mode: GLenum,
first: GLint,
count: GLsizei,
instance_count: GLsizei,
base_instance: GLuint,
) {
self.draw_arrays_instanced_base_instance_angle(mode, first, count, instance_count, base_instance)
}

fn draw_arrays_instanced_base_instance_angle(
&self,
mode: GLenum,
first: GLint,
count: GLsizei,
instance_count: GLsizei,
base_instance: GLuint,
) {
unsafe {
self.ffi_gl_
.DrawArraysInstancedBaseInstanceANGLE(mode, first, count, instance_count, base_instance);
}
}

fn draw_elements(
&self,
mode: GLenum,
Expand All @@ -1185,7 +1209,7 @@ impl Gl for GlesFns {
indices_offset: GLuint,
) {
unsafe {
return self.ffi_gl_.DrawElements(
self.ffi_gl_.DrawElements(
mode,
count,
element_type,
Expand All @@ -1203,7 +1227,7 @@ impl Gl for GlesFns {
primcount: GLsizei,
) {
unsafe {
return self.ffi_gl_.DrawElementsInstanced(
self.ffi_gl_.DrawElementsInstanced(
mode,
count,
element_type,
Expand All @@ -1213,6 +1237,49 @@ impl Gl for GlesFns {
}
}

fn draw_elements_instanced_base_instance(
&self,
mode: GLenum,
count: GLsizei,
element_type: GLenum,
indices_offset: GLuint,
instance_count: GLsizei,
base_instance: GLuint,
) {
self.draw_elements_instanced_base_vertex_base_instance_angle(
mode,
count,
element_type,
indices_offset,
instance_count,
0,
base_instance,
)
}

fn draw_elements_instanced_base_vertex_base_instance_angle(
&self,
mode: GLenum,
count: GLsizei,
element_type: GLenum,
indices_offset: GLuint,
instance_count: GLsizei,
base_vertex: GLsizei,
base_instance: GLuint,
) {
unsafe {
self.ffi_gl_.DrawElementsInstancedBaseVertexBaseInstanceANGLE(
mode,
count,
element_type,
indices_offset as *const c_void,
instance_count,
base_vertex,
base_instance,
);
}
}

fn blend_color(&self, r: f32, g: f32, b: f32, a: f32) {
unsafe {
self.ffi_gl_.BlendColor(r, g, b, a);
Expand Down