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

@ -6,7 +6,6 @@ use log::warn;
use swapchain::WGPUImageMap;
pub use swapchain::{ContextData, WGPUExternalImages};
use webgpu_traits::{WebGPU, WebGPUMsg};
use webrender::RenderApiSender;
use wgpu_thread::WGPU;
pub use {wgpu_core as wgc, wgpu_types as wgt};
@ -16,16 +15,14 @@ mod wgpu_thread;
use std::borrow::Cow;
use std::sync::{Arc, Mutex};
use compositing_traits::WebrenderExternalImageRegistry;
use compositing_traits::{CrossProcessCompositorApi, WebrenderExternalImageRegistry};
use ipc_channel::ipc::{self, IpcReceiver};
use servo_config::pref;
use webrender_api::DocumentId;
pub mod swapchain;
pub fn start_webgpu_thread(
webrender_api_sender: RenderApiSender,
webrender_document: DocumentId,
compositor_api: CrossProcessCompositorApi,
external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
wgpu_image_map: WGPUImageMap,
) -> Option<(WebGPU, IpcReceiver<WebGPUMsg>)> {
@ -62,8 +59,7 @@ pub fn start_webgpu_thread(
receiver,
sender_clone,
script_sender,
webrender_api_sender,
webrender_document,
compositor_api,
external_images,
wgpu_image_map,
)