webgpu: Use compositor_api instead of webrender_api (#37713)

webgpu currently sends updates WebRender directly via WebRender API
(same as webgl that I also plan to reform). 2D canvas uses Compositor
API for that and with this PR so does webgpu. This will be helpful for
#35733, where compositor must know state of image updates.

Testing: WebGPU CTS run:
https://github.com/sagudev/servo/actions/runs/15895299748

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev 2025-06-26 12:12:29 +02:00 committed by GitHub
parent 6656a09f8c
commit c8132137cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 38 additions and 86 deletions

View file

@ -164,8 +164,6 @@ use style_traits::CSSPixel;
use webgpu::swapchain::WGPUImageMap;
#[cfg(feature = "webgpu")]
use webgpu_traits::{WebGPU, WebGPURequest};
#[cfg(feature = "webgpu")]
use webrender::RenderApi;
use webrender::RenderApiSender;
use webrender_api::units::LayoutVector2D;
use webrender_api::{DocumentId, ExternalScrollId, ImageKey};
@ -222,9 +220,6 @@ struct MessagePortInfo {
#[cfg(feature = "webgpu")]
/// Webrender related objects required by WebGPU threads
struct WebrenderWGPU {
/// Webrender API.
webrender_api: RenderApi,
/// List of Webrender external images
webrender_external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
@ -362,10 +357,6 @@ pub struct Constellation<STF, SWF> {
/// memory profiler thread.
mem_profiler_chan: mem::ProfilerChan,
/// A single WebRender document the constellation operates on.
#[cfg(feature = "webgpu")]
webrender_document: DocumentId,
/// Webrender related objects required by WebGPU threads
#[cfg(feature = "webgpu")]
webrender_wgpu: WebrenderWGPU,
@ -657,7 +648,6 @@ where
#[cfg(feature = "webgpu")]
let webrender_wgpu = WebrenderWGPU {
webrender_api: state.webrender_api_sender.create_api(),
webrender_external_images: state.webrender_external_images,
wgpu_image_map: state.wgpu_image_map,
};
@ -705,8 +695,6 @@ where
webdriver: WebDriverData::new(),
document_states: HashMap::new(),
#[cfg(feature = "webgpu")]
webrender_document: state.webrender_document,
#[cfg(feature = "webgpu")]
webrender_wgpu,
shutting_down: false,
handled_warnings: VecDeque::new(),
@ -2052,8 +2040,7 @@ where
};
let webgpu_chan = match browsing_context_group.webgpus.entry(host) {
Entry::Vacant(v) => start_webgpu_thread(
self.webrender_wgpu.webrender_api.create_sender(),
self.webrender_document,
self.compositor_proxy.cross_process_compositor_api.clone(),
self.webrender_wgpu.webrender_external_images.clone(),
self.webrender_wgpu.wgpu_image_map.clone(),
)