Skip to content

Commit

Permalink
Auto merge of #4808 - moz-gfx:github-sync, r=auto
Browse files Browse the repository at this point in the history
Sync changes from mozilla-central gfx/wr

None
  • Loading branch information
bors-servo authored Apr 25, 2023
2 parents 9db8b20 + 346b91c commit 088e1ad
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example-compositor/compositor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion swgl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ glsl-to-cxx = { path = "../glsl-to-cxx" }
webrender_build = { path = "../webrender_build" }

[dependencies]
gleam = "0.13.1"
gleam = "0.15"
54 changes: 54 additions & 0 deletions swgl/src/swgl_fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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!();
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion webrender/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions webrender/src/device/gl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@ pub struct Capabilities {
pub supports_render_target_invalidate: bool,
/// Whether the driver can reliably upload data to R8 format textures.
pub supports_r8_texture_upload: bool,
/// Whether the extension QCOM_tiled_rendering is supported.
pub supports_qcom_tiled_rendering: bool,
/// Whether clip-masking is supported natively by the GL implementation
/// rather than emulated in shaders.
pub uses_native_clip_mask: bool,
Expand Down Expand Up @@ -1839,6 +1841,8 @@ impl Device {
true
};

let supports_qcom_tiled_rendering = supports_extension(&extensions, "GL_QCOM_tiled_rendering");

// On some Adreno 3xx devices the vertex array object must be unbound and rebound after
// an attached buffer has been orphaned.
let requires_vao_rebind_after_orphaning = is_adreno_3xx;
Expand Down Expand Up @@ -1876,6 +1880,7 @@ impl Device {
prefers_clear_scissor,
supports_render_target_invalidate,
supports_r8_texture_upload,
supports_qcom_tiled_rendering,
uses_native_clip_mask,
uses_native_antialiasing,
supports_image_external_essl3,
Expand Down
32 changes: 32 additions & 0 deletions webrender/src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2483,6 +2483,17 @@ impl Renderer {
{
let _timer = self.gpu_profiler.start_timer(GPU_TAG_SETUP_TARGET);
self.device.bind_draw_target(draw_target);

if self.device.get_capabilities().supports_qcom_tiled_rendering {
self.device.gl().start_tiling_qcom(
target.dirty_rect.min.x.max(0) as _,
target.dirty_rect.min.y.max(0) as _,
target.dirty_rect.width() as _,
target.dirty_rect.height() as _,
0,
);
}

self.device.enable_depth_write();
self.set_blend(false, framebuffer_kind);

Expand Down Expand Up @@ -2583,6 +2594,9 @@ impl Renderer {
}

self.device.invalidate_depth_target();
if self.device.get_capabilities().supports_qcom_tiled_rendering {
self.device.gl().end_tiling_qcom(gl::COLOR_BUFFER_BIT0_QCOM);
}
}

/// Draw an alpha batch container into a given draw target. This is used
Expand Down Expand Up @@ -3349,6 +3363,21 @@ impl Renderer {
{
let _timer = self.gpu_profiler.start_timer(GPU_TAG_SETUP_TARGET);
self.device.bind_draw_target(draw_target);

if self.device.get_capabilities().supports_qcom_tiled_rendering {
let preserve_mask = match target.clear_color {
Some(_) => 0,
None => gl::COLOR_BUFFER_BIT0_QCOM,
};
self.device.gl().start_tiling_qcom(
target.used_rect.min.x.max(0) as _,
target.used_rect.min.y.max(0) as _,
target.used_rect.width() as _,
target.used_rect.height() as _,
preserve_mask,
);
}

self.device.disable_depth();
self.set_blend(false, framebuffer_kind);

Expand Down Expand Up @@ -3479,6 +3508,9 @@ impl Renderer {
if clear_depth.is_some() {
self.device.invalidate_depth_target();
}
if self.device.get_capabilities().supports_qcom_tiled_rendering {
self.device.gl().end_tiling_qcom(gl::COLOR_BUFFER_BIT0_QCOM);
}
}

fn draw_blurs(
Expand Down
2 changes: 1 addition & 1 deletion wr_glyph_rasterizer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion wrench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down

0 comments on commit 088e1ad

Please sign in to comment.