From b5b69988ccd68c70050225d75694ae9eb0bb95f7 Mon Sep 17 00:00:00 2001 From: "Ngo Iok Ui (Wu Yu Wei)" Date: Fri, 7 Feb 2025 19:36:37 +0900 Subject: [PATCH] fix: bring back connection method to fix WebGL texture error (#35358) * Bring back connection method to fix texture error Signed-off-by: Wu Yuwei * Print GL info in log instead Signed-off-by: Wu Yuwei --------- Signed-off-by: Wu Yuwei --- components/canvas/webgl_mode/inprocess.rs | 4 +++- components/compositing/compositor.rs | 3 +++ components/shared/webrender/rendering_context.rs | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs index c72c8536e6f..562b230391b 100644 --- a/components/canvas/webgl_mode/inprocess.rs +++ b/components/canvas/webgl_mode/inprocess.rs @@ -48,7 +48,9 @@ impl WebGLComm { let webxr_init = crate::webxr::WebXRBridgeInit::new(sender.clone()); #[cfg(feature = "webxr")] let webxr_layer_grand_manager = webxr_init.layer_grand_manager(); - let connection = surfman::Connection::new().expect("Failed to create connection"); + let connection = rendering_context + .connection() + .expect("Failed to get connection"); let adapter = connection .create_adapter() .expect("Failed to create adapter"); diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index f882fe9d867..b8f5ca085f6 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -408,6 +408,9 @@ impl IOCompositor { version_string, }; + let gl = &compositor.webrender_gl; + info!("Running on {}", gl.get_string(gleam::gl::RENDERER)); + info!("OpenGL Version {}", gl.get_string(gleam::gl::VERSION)); compositor.assert_gl_framebuffer_complete(); compositor } diff --git a/components/shared/webrender/rendering_context.rs b/components/shared/webrender/rendering_context.rs index c65df845321..8b1e1165a3a 100644 --- a/components/shared/webrender/rendering_context.rs +++ b/components/shared/webrender/rendering_context.rs @@ -67,6 +67,11 @@ pub trait RenderingContext { fn destroy_texture(&self, _surface_texture: SurfaceTexture) -> Option { None } + + /// The connection to the display server for WebGL. Default to `None`. + fn connection(&self) -> Option { + None + } } /// A rendering context that uses the Surfman library to create and manage @@ -223,6 +228,10 @@ impl RenderingContext for SurfmanRenderingContext { fn destroy_texture(&self, surface_texture: SurfaceTexture) -> Option { self.destroy_surface_texture(surface_texture).ok() } + + fn connection(&self) -> Option { + Some(self.connection()) + } } impl SurfmanRenderingContext {