diff options
author | Cristian Brinza <cristianb@gmail.com> | 2024-08-25 08:43:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-25 05:43:06 +0000 |
commit | c79d9e68a39bc6c2ff396f8cb843d3d9abb01b1f (patch) | |
tree | 078196444195c4f1e8cfd602bd40b75d0091967b /components/servo/lib.rs | |
parent | 6caaa0c955fa7535554d50e46c1eb91bc2d2ba3b (diff) | |
download | servo-c79d9e68a39bc6c2ff396f8cb843d3d9abb01b1f.tar.gz servo-c79d9e68a39bc6c2ff396f8cb843d3d9abb01b1f.zip |
Use webrender `UploadMethod::Immediate` with ANGLE (#33177)
* Use webrender UploadMethod::Immediate with ANGLE
Signed-off-by: crbrz <cristianb@gmail.com>
* Added comment with Gecko link
Signed-off-by: crbrz <cristianb@gmail.com>
---------
Signed-off-by: crbrz <cristianb@gmail.com>
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r-- | components/servo/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 61a545771d5..ac6383a9297 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -66,6 +66,7 @@ use fonts::FontCacheThread; ))] use gaol::sandbox::{ChildSandbox, ChildSandboxMethods}; pub use gleam::gl; +use gleam::gl::RENDERER; use ipc_channel::ipc::{self, IpcSender}; #[cfg(feature = "layout_2013")] pub use layout_thread_2013; @@ -89,7 +90,7 @@ use surfman::platform::generic::multi::context::NativeContext as LinuxNativeCont use surfman::{GLApi, GLVersion}; #[cfg(all(target_os = "linux", not(target_env = "ohos")))] use surfman::{NativeConnection, NativeContext}; -use webrender::{RenderApiSender, ShaderPrecacheFlags}; +use webrender::{RenderApiSender, ShaderPrecacheFlags, UploadMethod, ONE_TIME_USAGE_HINT}; use webrender_api::{ ColorF, DocumentId, FontInstanceFlags, FontInstanceKey, FontKey, FramePublishId, ImageKey, NativeFontHandle, @@ -333,6 +334,13 @@ where clear_color[2] as f32, clear_color[3] as f32, ); + // Use same texture upload method as Gecko with ANGLE: + // https://searchfox.org/mozilla-central/source/gfx/webrender_bindings/src/bindings.rs#1215-1219 + let upload_method = if webrender_gl.get_string(RENDERER).starts_with("ANGLE") { + UploadMethod::Immediate + } else { + UploadMethod::PixelBuffer(ONE_TIME_USAGE_HINT) + }; webrender::create_webrender_instance( webrender_gl.clone(), render_notifier, @@ -354,6 +362,7 @@ where !opts.debug.disable_subpixel_text_antialiasing, allow_texture_swizzling: pref!(gfx.texture_swizzling.enabled), clear_color, + upload_method, ..Default::default() }, None, |