diff options
author | Martin Robinson <mrobinson@igalia.com> | 2025-02-17 09:35:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-17 08:35:05 +0000 |
commit | 6dce329acc67ee55b2a640add7791ace0be0180d (patch) | |
tree | e23f7c0fa7871c08d49a8eacb5a590d9f1e12709 /components/servo/lib.rs | |
parent | d466688526734c9eccfeebfe8e71bf1cbe69b192 (diff) | |
download | servo-6dce329acc67ee55b2a640add7791ace0be0180d.tar.gz servo-6dce329acc67ee55b2a640add7791ace0be0180d.zip |
libservo: Expose an `OffscreenRenderingContext` and use it for servoshell (#35465)
Create a new `RenderingContext` which is used to render to a
`SurfmanRenderingContext`-related offscreen buffer. This allows having a
temporary place to render Servo and then blitting the results to a
subsection of the parent `RenderingContext`.
The goal with this change is to remove the details of how servoshell
renders from the `Compositor` and prepare for the compositor-per-WebView
world.
Co-authred-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r-- | components/servo/lib.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 1a514a6f8ad..b90ceb3a3d8 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -305,10 +305,6 @@ impl Servo { } debug_assert_eq!(webrender_gl.get_error(), gleam::gl::NO_ERROR,); - // Bind the webrender framebuffer - let framebuffer_object = rendering_context.framebuffer_object(); - webrender_gl.bind_framebuffer(gleam::gl::FRAMEBUFFER, framebuffer_object); - // Reserving a namespace to create TopLevelBrowsingContextId. PipelineNamespace::install(PipelineNamespaceId(0)); @@ -346,6 +342,7 @@ impl Servo { opts.debug.webrender_stats, ); + rendering_context.prepare_for_rendering(); let render_notifier = Box::new(RenderNotifier::new(compositor_proxy.clone())); let clear_color = servo_config::pref!(shell_background_color_rgba); let clear_color = ColorF::new( @@ -354,6 +351,7 @@ impl Servo { 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") { @@ -702,12 +700,6 @@ impl Servo { self.compositor.borrow_mut().present(); } - /// Return the OpenGL framebuffer name of the most-recently-completed frame when compositing to - /// [`CompositeTarget::OffscreenFbo`], or None otherwise. - pub fn offscreen_framebuffer_id(&self) -> Option<u32> { - self.compositor.borrow().offscreen_framebuffer_id() - } - pub fn new_webview(&self, url: url::Url) -> WebView { let webview = WebView::new(&self.constellation_proxy, self.compositor.clone()); self.webviews |