webgpu: Sync various parts of spec (#33009)

* Sync `GPUObjectDescriptorBase` (label is not option anymore)

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Sync `GPUFeatureName`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* shader_f16 feature is not usable in wgpu so disable it

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* sync `GPUTextureFormat`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* `validate_texture_format_required_features`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Sync `GPUTexture` attributes

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Make `entryPoint` in `GPUProgrammableStage` optional

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Set good expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Bad expectations because naga does not support cons declarations

Also fail on firefox, where skipped before due to missing device features

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Bad expectation, also fails on firefox

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Bad expectations, because naga does not support `let pos = positions[vertex_index];`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Set expectation

external texture does not work in firefox too (again naga)

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* set bad expectations, because naga does not support `enable`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Set bad expectations for, `Texture with '' label has been destroyed`

also fails in firefox with same reason

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* one bad expectation

also on firefox

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* expect that also matches firefox

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* more expect

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Use only 1 proc for _webgpu

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* better doc comment

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-08-19 16:06:30 +02:00 committed by GitHub
parent f45c98496e
commit 94ff89a5e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 910 additions and 4947 deletions

View file

@ -110,10 +110,10 @@ impl GPUAdapterMethods for GPUAdapter {
// Step 2
let promise = Promise::new_in_current_realm(comp);
let sender = response_async(&promise, self);
let mut features = wgt::Features::empty();
let mut required_features = wgt::Features::empty();
for &ext in descriptor.requiredFeatures.iter() {
if let Some(feature) = gpu_to_wgt_feature(ext) {
features.insert(feature);
required_features.insert(feature);
} else {
promise.reject_error(Error::Type(format!(
"{} is not supported feature",
@ -123,21 +123,23 @@ impl GPUAdapterMethods for GPUAdapter {
}
}
let mut desc = wgt::DeviceDescriptor {
required_features: features,
required_limits: wgt::Limits::default(),
label: None,
memory_hints: MemoryHints::MemoryUsage,
};
let mut required_limits = wgt::Limits::default();
if let Some(limits) = &descriptor.requiredLimits {
for (limit, value) in (*limits).iter() {
if !set_limit(&mut desc.required_limits, limit.as_ref(), *value) {
if !set_limit(&mut required_limits, limit.as_ref(), *value) {
warn!("Unknown GPUDevice limit: {limit}");
promise.reject_error(Error::Operation);
return promise;
}
}
}
let desc = wgt::DeviceDescriptor {
required_features,
required_limits,
label: Some(descriptor.parent.label.to_string()),
memory_hints: MemoryHints::MemoryUsage,
};
let device_id = self
.global()
.wgpu_id_hub()