mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
1f928252e3
commit
49d48b897a
24 changed files with 354 additions and 348 deletions
|
@ -6,9 +6,9 @@ use std::rc::Rc;
|
|||
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{Heap, JSObject};
|
||||
use webgpu::wgc::instance::RequestDeviceError;
|
||||
use webgpu::wgt::{self, MemoryHints};
|
||||
use webgpu_traits::{WebGPU, WebGPUAdapter, WebGPUDeviceResponse, WebGPURequest};
|
||||
use wgpu_core::instance::RequestDeviceError;
|
||||
use wgpu_types::{self, MemoryHints};
|
||||
|
||||
use super::gpusupportedfeatures::GPUSupportedFeatures;
|
||||
use super::gpusupportedlimits::set_limit;
|
||||
|
@ -72,9 +72,9 @@ impl GPUAdapter {
|
|||
channel: WebGPU,
|
||||
name: DOMString,
|
||||
extensions: Heap<*mut JSObject>,
|
||||
features: wgt::Features,
|
||||
limits: wgt::Limits,
|
||||
info: wgt::AdapterInfo,
|
||||
features: wgpu_types::Features,
|
||||
limits: wgpu_types::Limits,
|
||||
info: wgpu_types::AdapterInfo,
|
||||
adapter: WebGPUAdapter,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
|
@ -117,7 +117,7 @@ impl GPUAdapterMethods<crate::DomTypeHolder> for GPUAdapter {
|
|||
// Step 2
|
||||
let promise = Promise::new_in_current_realm(comp, can_gc);
|
||||
let sender = route_promise(&promise, self);
|
||||
let mut required_features = wgt::Features::empty();
|
||||
let mut required_features = wgpu_types::Features::empty();
|
||||
for &ext in descriptor.requiredFeatures.iter() {
|
||||
if let Some(feature) = gpu_to_wgt_feature(ext) {
|
||||
required_features.insert(feature);
|
||||
|
@ -130,7 +130,7 @@ impl GPUAdapterMethods<crate::DomTypeHolder> for GPUAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
let mut required_limits = wgt::Limits::default();
|
||||
let mut required_limits = wgpu_types::Limits::default();
|
||||
if let Some(limits) = &descriptor.requiredLimits {
|
||||
for (limit, value) in (*limits).iter() {
|
||||
if !set_limit(&mut required_limits, limit.as_ref(), *value) {
|
||||
|
@ -141,7 +141,7 @@ impl GPUAdapterMethods<crate::DomTypeHolder> for GPUAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
let desc = wgt::DeviceDescriptor {
|
||||
let desc = wgpu_types::DeviceDescriptor {
|
||||
required_features,
|
||||
required_limits,
|
||||
label: Some(descriptor.parent.label.to_string()),
|
||||
|
@ -242,8 +242,8 @@ impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
|
|||
self.channel.clone(),
|
||||
self,
|
||||
Heap::default(),
|
||||
wgt::Features::default(),
|
||||
wgt::Limits::default(),
|
||||
wgpu_types::Features::default(),
|
||||
wgpu_types::Limits::default(),
|
||||
device_id,
|
||||
queue_id,
|
||||
String::new(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue