From d62fe2d0aa88470026acfd1e8ac1c0bfc87d130f Mon Sep 17 00:00:00 2001 From: Jamie Nicol Date: Mon, 24 Apr 2023 16:37:06 +0000 Subject: [PATCH] Bug 1828248 - Update gleam to 0.15. r=gfx-reviewers,supply-chain-reviewers,jrmuizel This provides us with QCOM_tiled_rendering, which will be used in the next patch in this series. Differential Revision: https://phabricator.services.mozilla.com/D176153 --- Cargo.lock | 4 +- gfx/webrender_bindings/Cargo.toml | 2 +- gfx/wr/Cargo.lock | 4 +- .../example-compositor/compositor/Cargo.toml | 2 +- gfx/wr/examples/Cargo.toml | 2 +- gfx/wr/swgl/Cargo.toml | 2 +- gfx/wr/swgl/src/swgl_fns.rs | 54 +++++++++++++++++++ gfx/wr/webrender/Cargo.toml | 2 +- gfx/wr/wr_glyph_rasterizer/Cargo.toml | 2 +- gfx/wr/wrench/Cargo.toml | 2 +- supply-chain/audits.toml | 5 ++ third_party/rust/gleam/.cargo-checksum.json | 2 +- third_party/rust/gleam/Cargo.toml | 13 ++--- third_party/rust/gleam/build.rs | 2 + third_party/rust/gleam/src/gl.rs | 8 +++ third_party/rust/gleam/src/gl_fns.rs | 26 +++++++++ third_party/rust/gleam/src/gles_fns.rs | 32 +++++++++++ 17 files changed, 146 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d9fed03b0e88..924a40922ac4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2191,9 +2191,9 @@ dependencies = [ [[package]] name = "gleam" -version = "0.13.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "992c40589d382354958af7c60910026ed4cc3c58751355db21a4c2fbef15727a" +checksum = "0173481f2bb6e809bf4985de2e86c83876d84d2805830e3301cd37355e897f0f" dependencies = [ "gl_generator", ] diff --git a/gfx/webrender_bindings/Cargo.toml b/gfx/webrender_bindings/Cargo.toml index 2868bf3abd13..69a7eef1c058 100644 --- a/gfx/webrender_bindings/Cargo.toml +++ b/gfx/webrender_bindings/Cargo.toml @@ -11,7 +11,7 @@ num_cpus = "1.7.0" tracy-rs = "0.1" euclid = { version = "0.22.5", features = ["serde"] } app_units = "0.7" -gleam = "0.13.1" +gleam = "0.15" log = "0.4" nsstring = { path = "../../xpcom/rust/nsstring" } bincode = "1.0" diff --git a/gfx/wr/Cargo.lock b/gfx/wr/Cargo.lock index de9bf93b82e3..86f6dc2916d5 100644 --- a/gfx/wr/Cargo.lock +++ b/gfx/wr/Cargo.lock @@ -931,9 +931,9 @@ dependencies = [ [[package]] name = "gleam" -version = "0.13.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "992c40589d382354958af7c60910026ed4cc3c58751355db21a4c2fbef15727a" +checksum = "0173481f2bb6e809bf4985de2e86c83876d84d2805830e3301cd37355e897f0f" dependencies = [ "gl_generator 0.14.0", ] diff --git a/gfx/wr/example-compositor/compositor/Cargo.toml b/gfx/wr/example-compositor/compositor/Cargo.toml index 4202332c41db..02c6ebe0ce27 100644 --- a/gfx/wr/example-compositor/compositor/Cargo.toml +++ b/gfx/wr/example-compositor/compositor/Cargo.toml @@ -7,7 +7,7 @@ license = "MPL-2.0" [dependencies] webrender = { path = "../../webrender" } -gleam = "0.13.1" +gleam = "0.15" [target.'cfg(windows)'.dependencies] compositor-windows = { path = "../compositor-windows" } diff --git a/gfx/wr/examples/Cargo.toml b/gfx/wr/examples/Cargo.toml index 525095a0e859..9065707538a5 100644 --- a/gfx/wr/examples/Cargo.toml +++ b/gfx/wr/examples/Cargo.toml @@ -57,7 +57,7 @@ debug = ["webrender/capture", "webrender/profiler"] app_units = "0.7" env_logger = { version = "0.10", default_features = false } euclid = "0.22" -gleam = "0.13" +gleam = "0.15" glutin = "0.28" rayon = "1" webrender = { path = "../webrender" } diff --git a/gfx/wr/swgl/Cargo.toml b/gfx/wr/swgl/Cargo.toml index 9b7624b13e70..2e84e2267c12 100644 --- a/gfx/wr/swgl/Cargo.toml +++ b/gfx/wr/swgl/Cargo.toml @@ -12,4 +12,4 @@ glsl-to-cxx = { path = "../glsl-to-cxx" } webrender_build = { path = "../webrender_build" } [dependencies] -gleam = "0.13.1" +gleam = "0.15" diff --git a/gfx/wr/swgl/src/swgl_fns.rs b/gfx/wr/swgl/src/swgl_fns.rs index d3afb7233c01..79669bd205f0 100644 --- a/gfx/wr/swgl/src/swgl_fns.rs +++ b/gfx/wr/swgl/src/swgl_fns.rs @@ -964,6 +964,16 @@ impl Gl for Context { } } + fn bind_vertex_buffer( + &self, + binding_index: GLuint, + buffer: GLuint, + offset: GLintptr, + stride: GLint, + ) { + unimplemented!("Not supported by SWGL"); + } + fn bind_texture(&self, target: GLenum, texture: GLuint) { //panic!(); unsafe { @@ -1405,6 +1415,10 @@ impl Gl for Context { panic!(); } + fn vertex_attrib_binding(&self, attrib_index: GLuint, binding_index: GLuint) { + unimplemented!("Not supported by SWGL"); + } + fn vertex_attrib_pointer_f32( &self, index: GLuint, @@ -1469,6 +1483,31 @@ impl Gl for Context { } } + fn vertex_attrib_format( + &self, + attrib_index: GLuint, + size: GLint, + type_: GLenum, + normalized: bool, + relative_offset: GLuint, + ) { + unimplemented!("Not supported by SWGL"); + } + + fn vertex_attrib_i_format( + &self, + attrib_index: GLuint, + size: GLint, + type_: GLenum, + relative_offset: GLuint, + ) { + unimplemented!("Not supported by SWGL"); + } + + fn vertex_binding_divisor(&self, binding_index: GLuint, divisor: GLuint) { + unimplemented!("Not supported by SWGL"); + } + fn viewport(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei) { debug!("viewport {} {} {} {}", x, y, width, height); //panic!(); @@ -2285,6 +2324,21 @@ impl Gl for Context { fn flush_mapped_buffer_range(&self, target: GLenum, offset: GLintptr, length: GLsizeiptr) { unimplemented!("Not supported by SWGL"); } + + fn start_tiling_qcom( + &self, + x: GLuint, + y: GLuint, + width: GLuint, + height: GLuint, + preserve_mask: GLbitfield, + ) { + unimplemented!("Not supported by SWGL"); + } + + fn end_tiling_qcom(&self, preserve_mask: GLbitfield) { + unimplemented!("Not supported by SWGL"); + } } /// A resource that is intended for sharing between threads. diff --git a/gfx/wr/webrender/Cargo.toml b/gfx/wr/webrender/Cargo.toml index 5280738c1863..2205fc1c0c73 100644 --- a/gfx/wr/webrender/Cargo.toml +++ b/gfx/wr/webrender/Cargo.toml @@ -32,7 +32,7 @@ bitflags = "1.2" byteorder = "1.0" euclid = { version = "0.22.0", features = ["serde"] } fxhash = "0.2.1" -gleam = "0.13.1" +gleam = "0.15.0" lazy_static = "1" log = "0.4" malloc_size_of_derive = "0.1" diff --git a/gfx/wr/wr_glyph_rasterizer/Cargo.toml b/gfx/wr/wr_glyph_rasterizer/Cargo.toml index 89f4cfce5109..89da5cd954fd 100644 --- a/gfx/wr/wr_glyph_rasterizer/Cargo.toml +++ b/gfx/wr/wr_glyph_rasterizer/Cargo.toml @@ -32,7 +32,7 @@ serde = { optional = true, version = "1.0", features = ["serde_derive"] } [dev-dependencies] env_logger = { version = "0.10", default_features = false } euclid = "0.22" -gleam = "0.13" +gleam = "0.15" glutin = "0.28" rayon = "1" winit = "0.26" diff --git a/gfx/wr/wrench/Cargo.toml b/gfx/wr/wrench/Cargo.toml index c0ed6a89cab2..1c434b789464 100644 --- a/gfx/wr/wrench/Cargo.toml +++ b/gfx/wr/wrench/Cargo.toml @@ -14,7 +14,7 @@ path = "src/main.rs" [dependencies] base64 = "0.13" env_logger = { version = "0.10", optional = true, default_features = false } -gleam = "0.13" +gleam = "0.15" glutin = "0.28" clap = { version = "3.1", features = ["yaml"] } glsl-lang = { version = "0.2", features = ["lexer-v2-full"] } diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index c637c7a32fdd..8cd8780cbd96 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -1109,6 +1109,11 @@ who = "Mike Hommey " criteria = "safe-to-deploy" delta = "0.2.7 -> 0.2.8" +[[audits.gleam]] +who = "Jamie Nicol " +criteria = "safe-to-deploy" +delta = "0.13.1 -> 0.15.0" + [[audits.glob]] who = "Mike Hommey " criteria = "safe-to-deploy" diff --git a/third_party/rust/gleam/.cargo-checksum.json b/third_party/rust/gleam/.cargo-checksum.json index 47de0227531b..651bf11aab55 100644 --- a/third_party/rust/gleam/.cargo-checksum.json +++ b/third_party/rust/gleam/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"aafaa93ede79cc66087ed617d13a1aebc4fe09fc7bf4672d6b751163e41f3eda","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"1acb12040be43a3582d5897f11870b3ffdcd7ce0f4f32de158175bb6b33ec0b7","build.rs":"de46062da47ddfc16a7be97d9c026df044af0c25a49035214c4e88aa4e0e5cbf","rustfmt.toml":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/gl.rs":"7e20ad9a3cc2db1e451bb0a52c8cd3687cf1a1c495954f999aa1e299e3d54250","src/gl_fns.rs":"01940aa48c204e8f95ee025e0c386f10f2dcd43cde4798f91372d2870fe3cf53","src/gles_fns.rs":"74951f6ae58fb1c2b51129c018df74845e367c7f08bc1ff7873007bb06e80c60","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"992c40589d382354958af7c60910026ed4cc3c58751355db21a4c2fbef15727a"} \ No newline at end of file +{"files":{"COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"6dce42dfad850b93a2d4a2d29ab4c8de9c7bd783e6870ceec5fd8dccb960e50f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"1acb12040be43a3582d5897f11870b3ffdcd7ce0f4f32de158175bb6b33ec0b7","build.rs":"cf4ed31d33c2dcc3cb16648ce60c6ac69a7959fbd2491aa3565237f601a1ef18","rustfmt.toml":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/gl.rs":"c10739f5382209a4a4715a9e38b3a263f750f52a7b5131c31683f0fd221e8d00","src/gl_fns.rs":"03c0232de8e1ffb8db3b4669cefe00f8e8c4ba49504276b0b84c88804cc01d13","src/gles_fns.rs":"7101fd4dbc354c2b375a8a525623d29ee5ac0e6cd13bf78c93a264fc50c0b589","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"0173481f2bb6e809bf4985de2e86c83876d84d2805830e3301cd37355e897f0f"} \ No newline at end of file diff --git a/third_party/rust/gleam/Cargo.toml b/third_party/rust/gleam/Cargo.toml index f0e6264c952d..7cc789b30256 100644 --- a/third_party/rust/gleam/Cargo.toml +++ b/third_party/rust/gleam/Cargo.toml @@ -3,21 +3,22 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] name = "gleam" -version = "0.13.1" +version = "0.15.0" authors = ["The Servo Project Developers"] build = "build.rs" description = "Generated OpenGL bindings and wrapper for Servo." documentation = "https://doc.servo.org/gleam/" +readme = "README.md" license = "Apache-2.0/MIT" repository = "https://github.com/servo/gleam" + [build-dependencies.gl_generator] version = "0.14" diff --git a/third_party/rust/gleam/build.rs b/third_party/rust/gleam/build.rs index 6a15783a1b5f..12fd38e37399 100644 --- a/third_party/rust/gleam/build.rs +++ b/third_party/rust/gleam/build.rs @@ -25,6 +25,7 @@ fn main() { "GL_ARB_invalidate_subdata", "GL_ARB_texture_rectangle", "GL_ARB_texture_storage", + "GL_ARB_vertex_attrib_binding", "GL_EXT_debug_marker", "GL_EXT_texture_filter_anisotropic", "GL_KHR_debug", @@ -65,6 +66,7 @@ fn main() { "GL_KHR_blend_equation_advanced", "GL_KHR_blend_equation_advanced_coherent", "GL_ANGLE_copy_texture_3d", + "GL_QCOM_tiled_rendering", ]; let gles_reg = Registry::new( Api::Gles2, diff --git a/third_party/rust/gleam/src/gl.rs b/third_party/rust/gleam/src/gl.rs index e66ff6dbfe2e..6293d811008b 100644 --- a/third_party/rust/gleam/src/gl.rs +++ b/third_party/rust/gleam/src/gl.rs @@ -241,6 +241,7 @@ declare_gl_apis! { fn bind_renderbuffer(&self, target: GLenum, renderbuffer: GLuint); fn bind_framebuffer(&self, target: GLenum, framebuffer: GLuint); fn bind_texture(&self, target: GLenum, texture: GLuint); + fn bind_vertex_buffer(&self, binding_index: GLuint, buffer: GLuint, offset: GLintptr, stride: GLint); fn draw_buffers(&self, bufs: &[GLenum]); fn tex_image_2d( &self, @@ -477,6 +478,7 @@ declare_gl_apis! { filter: GLenum, ); fn vertex_attrib_4f(&self, index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat); + fn vertex_attrib_binding(&self, attrib_index: GLuint, binding_index: GLuint); fn vertex_attrib_pointer_f32( &self, index: GLuint, @@ -503,6 +505,9 @@ declare_gl_apis! { offset: GLuint, ); fn vertex_attrib_divisor(&self, index: GLuint, divisor: GLuint); + fn vertex_attrib_format(&self, attrib_index: GLuint, size: GLint, type_: GLenum, normalized: bool, relative_offset: GLuint); + fn vertex_attrib_i_format(&self, attrib_index: GLuint, size: GLint, type_: GLenum, relative_offset: GLuint); + fn vertex_binding_divisor(&self, binding_index: GLuint, divisor: GLuint); fn viewport(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei); fn scissor(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei); fn line_width(&self, width: GLfloat); @@ -756,6 +761,9 @@ declare_gl_apis! { ); fn flush_mapped_buffer_range(&self, target: GLenum, offset: GLintptr, length: GLsizeiptr); + + fn start_tiling_qcom(&self, x: GLuint, y: GLuint, width: GLuint, height: GLuint, preserve_mask: GLbitfield); + fn end_tiling_qcom(&self, preserve_mask: GLbitfield); } //#[deprecated(since = "0.6.11", note = "use ErrorReactingGl instead")] diff --git a/third_party/rust/gleam/src/gl_fns.rs b/third_party/rust/gleam/src/gl_fns.rs index 0c7eb26f781a..8e00c7e5632f 100644 --- a/third_party/rust/gleam/src/gl_fns.rs +++ b/third_party/rust/gleam/src/gl_fns.rs @@ -512,6 +512,10 @@ impl Gl for GlFns { } } + fn bind_vertex_buffer(&self, binding_index: GLuint, buffer: GLuint, offset: GLintptr, stride: GLint) { + unsafe { self.ffi_gl_.BindVertexBuffer(binding_index, buffer, offset, stride) } + } + fn draw_buffers(&self, bufs: &[GLenum]) { unsafe { self.ffi_gl_ @@ -1074,6 +1078,10 @@ impl Gl for GlFns { unsafe { self.ffi_gl_.VertexAttrib4f(index, x, y, z, w) } } + fn vertex_attrib_binding(&self, attrib_index: GLuint, binding_index: GLuint) { + unsafe { self.ffi_gl_.VertexAttribBinding(attrib_index, binding_index) } + } + fn vertex_attrib_pointer_f32( &self, index: GLuint, @@ -1133,6 +1141,18 @@ impl Gl for GlFns { unsafe { self.ffi_gl_.VertexAttribDivisor(index, divisor) } } + fn vertex_attrib_format(&self, attrib_index: GLuint, size: GLint, type_: GLenum, normalized: bool, relative_offset: GLuint) { + unsafe { self.ffi_gl_.VertexAttribFormat(attrib_index, size, type_, normalized as GLboolean, relative_offset) } + } + + fn vertex_attrib_i_format(&self, attrib_index: GLuint, size: GLint, type_: GLenum, relative_offset: GLuint) { + unsafe { self.ffi_gl_.VertexAttribIFormat(attrib_index, size, type_, relative_offset) } + } + + fn vertex_binding_divisor(&self, binding_index: GLuint, divisor: GLuint) { + unsafe { self.ffi_gl_.VertexBindingDivisor(binding_index, divisor) } + } + fn viewport(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei) { unsafe { self.ffi_gl_.Viewport(x, y, width, height); @@ -2264,4 +2284,10 @@ impl Gl for GlFns { self.ffi_gl_.FlushMappedBufferRange(target, offset, length); } } + + fn start_tiling_qcom(&self, _x: GLuint, _y: GLuint, _width: GLuint, _height: GLuint, _preserve_mask: GLbitfield) { + } + + fn end_tiling_qcom(&self, _preserve_mask: GLbitfield) { + } } diff --git a/third_party/rust/gleam/src/gles_fns.rs b/third_party/rust/gleam/src/gles_fns.rs index 7fbba87ba042..ee7ea70265f0 100644 --- a/third_party/rust/gleam/src/gles_fns.rs +++ b/third_party/rust/gleam/src/gles_fns.rs @@ -525,6 +525,10 @@ impl Gl for GlesFns { } } + fn bind_vertex_buffer(&self, binding_index: GLuint, buffer: GLuint, offset: GLintptr, stride: GLint) { + unsafe { self.ffi_gl_.BindVertexBuffer(binding_index, buffer, offset, stride) } + } + fn draw_buffers(&self, bufs: &[GLenum]) { unsafe { self.ffi_gl_ @@ -1077,6 +1081,10 @@ impl Gl for GlesFns { unsafe { self.ffi_gl_.VertexAttrib4f(index, x, y, z, w) } } + fn vertex_attrib_binding(&self, attrib_index: GLuint, binding_index: GLuint) { + unsafe { self.ffi_gl_.VertexAttribBinding(attrib_index, binding_index) } + } + fn vertex_attrib_pointer_f32( &self, index: GLuint, @@ -1136,6 +1144,18 @@ impl Gl for GlesFns { unsafe { self.ffi_gl_.VertexAttribDivisor(index, divisor) } } + fn vertex_attrib_format(&self, attrib_index: GLuint, size: GLint, type_: GLenum, normalized: bool, relative_offset: GLuint) { + unsafe { self.ffi_gl_.VertexAttribFormat(attrib_index, size, type_, normalized as GLboolean, relative_offset) } + } + + fn vertex_attrib_i_format(&self, attrib_index: GLuint, size: GLint, type_: GLenum, relative_offset: GLuint) { + unsafe { self.ffi_gl_.VertexAttribIFormat(attrib_index, size, type_, relative_offset) } + } + + fn vertex_binding_divisor(&self, binding_index: GLuint, divisor: GLuint) { + unsafe { self.ffi_gl_.VertexBindingDivisor(binding_index, divisor) } + } + fn viewport(&self, x: GLint, y: GLint, width: GLsizei, height: GLsizei) { unsafe { self.ffi_gl_.Viewport(x, y, width, height); @@ -2266,4 +2286,16 @@ impl Gl for GlesFns { self.ffi_gl_.FlushMappedBufferRange(target, offset, length); } } + + fn start_tiling_qcom(&self, x: GLuint, y: GLuint, width: GLuint, height: GLuint, preserve_mask: GLbitfield) { + unsafe { + self.ffi_gl_.StartTilingQCOM(x, y, width, height, preserve_mask); + } + } + + fn end_tiling_qcom(&self, preserve_mask: GLbitfield) { + unsafe { + self.ffi_gl_.EndTilingQCOM(preserve_mask); + } + } }