script: Remove dependency on webgpu (#36332)

After #36320, `script` only depends on `webgpu` for its type aliases to
`wgpu_core` and `wgpu_types`. This change removes the dependency on
`webgpu` in favor of depending directly on the upstream crates. This
makes it so that you can change `webgpu` without recompiling `script`.

Testing: This change is covered by existing WebGPU tests and is mainly
just changing the way dependencies are accessed.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-04-04 13:52:58 +02:00 committed by GitHub
parent 1f928252e3
commit 49d48b897a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 354 additions and 348 deletions

View file

@ -5,11 +5,10 @@
use std::borrow::Cow;
use dom_struct::dom_struct;
use webgpu::wgc::command::{
use webgpu_traits::{WebGPU, WebGPURenderBundle, WebGPURequest};
use wgpu_core::command::{
RenderBundleEncoder, RenderBundleEncoderDescriptor, bundle_ffi as wgpu_bundle,
};
use webgpu::wgt;
use webgpu_traits::{WebGPU, WebGPURenderBundle, WebGPURequest};
use crate::conversions::Convert;
use crate::dom::bindings::cell::DomRefCell;
@ -106,7 +105,7 @@ impl GPURenderBundleEncoder {
.map(|dsf| {
device
.validate_texture_format_required_features(&dsf)
.map(|format| wgt::RenderBundleDepthStencil {
.map(|format| wgpu_types::RenderBundleDepthStencil {
format,
depth_read_only: descriptor.depthReadOnly,
stencil_read_only: descriptor.stencilReadOnly,
@ -178,11 +177,11 @@ impl GPURenderBundleEncoderMethods<crate::DomTypeHolder> for GPURenderBundleEnco
encoder,
buffer.id().0,
match index_format {
GPUIndexFormat::Uint16 => wgt::IndexFormat::Uint16,
GPUIndexFormat::Uint32 => wgt::IndexFormat::Uint32,
GPUIndexFormat::Uint16 => wgpu_types::IndexFormat::Uint16,
GPUIndexFormat::Uint32 => wgpu_types::IndexFormat::Uint32,
},
offset,
wgt::BufferSize::new(size),
wgpu_types::BufferSize::new(size),
);
}
}
@ -195,7 +194,7 @@ impl GPURenderBundleEncoderMethods<crate::DomTypeHolder> for GPURenderBundleEnco
slot,
buffer.id().0,
offset,
wgt::BufferSize::new(size),
wgpu_types::BufferSize::new(size),
);
}
}
@ -258,7 +257,7 @@ impl GPURenderBundleEncoderMethods<crate::DomTypeHolder> for GPURenderBundleEnco
/// <https://gpuweb.github.io/gpuweb/#dom-gpurenderbundleencoder-finish>
fn Finish(&self, descriptor: &GPURenderBundleDescriptor) -> DomRoot<GPURenderBundle> {
let desc = wgt::RenderBundleDescriptor {
let desc = wgpu_types::RenderBundleDescriptor {
label: (&descriptor.parent).convert(),
};
let encoder = self.render_bundle_encoder.borrow_mut().take().unwrap();