webgpu: leverage routed_promise in calls returning promises (#35859)

Using the RoutedPromiseListener let us define a different
response type for each promise. This removes unreachable branches
that used to exist when they all shared the same WebGPUResponse.

Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
webbeef 2025-03-23 11:52:46 -07:00 committed by GitHub
parent 4814cbdb1f
commit 1c9f486f88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 221 additions and 263 deletions

View file

@ -5,7 +5,10 @@
use dom_struct::dom_struct;
use ipc_channel::ipc::IpcSender;
use webgpu::wgc::pipeline::RenderPipelineDescriptor;
use webgpu::{WebGPU, WebGPUBindGroupLayout, WebGPURenderPipeline, WebGPURequest, WebGPUResponse};
use webgpu::{
WebGPU, WebGPUBindGroupLayout, WebGPURenderPipeline, WebGPURenderPipelineResponse,
WebGPURequest,
};
use crate::dom::bindings::cell::DomRefCell;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineMethods;
@ -74,7 +77,7 @@ impl GPURenderPipeline {
device: &GPUDevice,
pipeline_layout: PipelineLayout,
descriptor: RenderPipelineDescriptor<'static>,
async_sender: Option<IpcSender<WebGPUResponse>>,
async_sender: Option<IpcSender<WebGPURenderPipelineResponse>>,
) -> Fallible<WebGPURenderPipeline> {
let render_pipeline_id = device.global().wgpu_id_hub().create_render_pipeline_id();