Update to latest WebGPU WebIDL (#2037)

This commit is contained in:
Josh Groves 2020-03-10 11:57:48 -02:30 committed by GitHub
parent 5534253280
commit 035902ab51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 98 additions and 74 deletions

View File

@ -381,11 +381,11 @@ Gpu = []
GpuAdapter = []
GpuAddressMode = []
GpuBindGroup = []
GpuBindGroupBinding = []
GpuBindGroupDescriptor = []
GpuBindGroupEntry = []
GpuBindGroupLayout = []
GpuBindGroupLayoutBinding = []
GpuBindGroupLayoutDescriptor = []
GpuBindGroupLayoutEntry = []
GpuBindingType = []
GpuBlendDescriptor = []
GpuBlendFactor = []

View File

@ -4,21 +4,21 @@ use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [ wasm_bindgen ( extends = :: js_sys :: Object , js_name = GPUBindGroupBinding ) ]
# [ wasm_bindgen ( extends = :: js_sys :: Object , js_name = GPUBindGroupEntry ) ]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `GpuBindGroupBinding` dictionary."]
#[doc = "The `GpuBindGroupEntry` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type GpuBindGroupBinding;
pub type GpuBindGroupEntry;
}
#[cfg(web_sys_unstable_apis)]
impl GpuBindGroupBinding {
#[doc = "Construct a new `GpuBindGroupBinding`."]
impl GpuBindGroupEntry {
#[doc = "Construct a new `GpuBindGroupEntry`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -32,7 +32,7 @@ impl GpuBindGroupBinding {
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `binding` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -53,7 +53,7 @@ impl GpuBindGroupBinding {
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `resource` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]

View File

@ -4,22 +4,22 @@ use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [ wasm_bindgen ( extends = :: js_sys :: Object , js_name = GPUBindGroupLayoutBinding ) ]
# [ wasm_bindgen ( extends = :: js_sys :: Object , js_name = GPUBindGroupLayoutEntry ) ]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `GpuBindGroupLayoutBinding` dictionary."]
#[doc = "The `GpuBindGroupLayoutEntry` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type GpuBindGroupLayoutBinding;
pub type GpuBindGroupLayoutEntry;
}
#[cfg(web_sys_unstable_apis)]
impl GpuBindGroupLayoutBinding {
impl GpuBindGroupLayoutEntry {
#[cfg(feature = "GpuBindingType")]
#[doc = "Construct a new `GpuBindGroupLayoutBinding`."]
#[doc = "Construct a new `GpuBindGroupLayoutEntry`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`, `GpuBindingType`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuBindingType`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -34,7 +34,7 @@ impl GpuBindGroupLayoutBinding {
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `binding` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -55,7 +55,7 @@ impl GpuBindGroupLayoutBinding {
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `hasDynamicOffset` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -76,7 +76,7 @@ impl GpuBindGroupLayoutBinding {
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `multisampled` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -95,10 +95,32 @@ impl GpuBindGroupLayoutBinding {
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureFormat")]
#[doc = "Change the `storageTextureFormat` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuTextureFormat`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn storage_texture_format(&mut self, val: GpuTextureFormat) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("storageTextureFormat"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureComponentType")]
#[doc = "Change the `textureComponentType` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`, `GpuTextureComponentType`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuTextureComponentType`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -117,32 +139,10 @@ impl GpuBindGroupLayoutBinding {
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureViewDimension")]
#[doc = "Change the `textureDimension` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`, `GpuTextureViewDimension`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn texture_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("textureDimension"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBindingType")]
#[doc = "Change the `type` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`, `GpuBindingType`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuBindingType`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@ -157,9 +157,31 @@ impl GpuBindGroupLayoutBinding {
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureViewDimension")]
#[doc = "Change the `viewDimension` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuTextureViewDimension`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn view_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("viewDimension"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `visibility` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]

View File

@ -14,6 +14,8 @@ pub enum GpuBindingType {
StorageBuffer = "storage-buffer",
ReadonlyStorageBuffer = "readonly-storage-buffer",
Sampler = "sampler",
ComparisonSampler = "comparison-sampler",
SampledTexture = "sampled-texture",
StorageTexture = "storage-texture",
ReadonlyStorageTexture = "readonly-storage-texture",
WriteonlyStorageTexture = "writeonly-storage-texture",
}

View File

@ -23,11 +23,10 @@ impl GpuBufferCopyView {
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(buffer: &GpuBuffer, image_height: u32, row_pitch: u32) -> Self {
pub fn new(buffer: &GpuBuffer, row_pitch: u32) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.buffer(buffer);
ret.image_height(image_height);
ret.row_pitch(row_pitch);
ret
}

View File

@ -22,7 +22,7 @@ impl GpuShaderModuleDescriptor {
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(code: &::wasm_bindgen::JsValue) -> Self {
pub fn new(code: &str) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.code(code);
@ -52,7 +52,7 @@ impl GpuShaderModuleDescriptor {
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn code(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
pub fn code(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("code"), &JsValue::from(val));
debug_assert!(

View File

@ -2104,36 +2104,36 @@ mod gen_GpuBindGroup;
#[cfg(feature = "GpuBindGroup")]
pub use gen_GpuBindGroup::*;
#[cfg(feature = "GpuBindGroupBinding")]
#[allow(non_snake_case)]
mod gen_GpuBindGroupBinding;
#[cfg(feature = "GpuBindGroupBinding")]
pub use gen_GpuBindGroupBinding::*;
#[cfg(feature = "GpuBindGroupDescriptor")]
#[allow(non_snake_case)]
mod gen_GpuBindGroupDescriptor;
#[cfg(feature = "GpuBindGroupDescriptor")]
pub use gen_GpuBindGroupDescriptor::*;
#[cfg(feature = "GpuBindGroupEntry")]
#[allow(non_snake_case)]
mod gen_GpuBindGroupEntry;
#[cfg(feature = "GpuBindGroupEntry")]
pub use gen_GpuBindGroupEntry::*;
#[cfg(feature = "GpuBindGroupLayout")]
#[allow(non_snake_case)]
mod gen_GpuBindGroupLayout;
#[cfg(feature = "GpuBindGroupLayout")]
pub use gen_GpuBindGroupLayout::*;
#[cfg(feature = "GpuBindGroupLayoutBinding")]
#[allow(non_snake_case)]
mod gen_GpuBindGroupLayoutBinding;
#[cfg(feature = "GpuBindGroupLayoutBinding")]
pub use gen_GpuBindGroupLayoutBinding::*;
#[cfg(feature = "GpuBindGroupLayoutDescriptor")]
#[allow(non_snake_case)]
mod gen_GpuBindGroupLayoutDescriptor;
#[cfg(feature = "GpuBindGroupLayoutDescriptor")]
pub use gen_GpuBindGroupLayoutDescriptor::*;
#[cfg(feature = "GpuBindGroupLayoutEntry")]
#[allow(non_snake_case)]
mod gen_GpuBindGroupLayoutEntry;
#[cfg(feature = "GpuBindGroupLayoutEntry")]
pub use gen_GpuBindGroupLayoutEntry::*;
#[cfg(feature = "GpuBindingType")]
#[allow(non_snake_case)]
mod gen_GpuBindingType;

View File

@ -246,7 +246,7 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
GPUFilterMode mipmapFilter = "nearest";
float lodMinClamp = 0;
float lodMaxClamp = 0xffffffff; // TODO: What should this be? Was Number.MAX_VALUE.
GPUCompareFunction compare = "never";
GPUCompareFunction compare;
};
enum GPUAddressMode {
@ -277,17 +277,18 @@ interface GPUBindGroupLayout {
GPUBindGroupLayout includes GPUObjectBase;
dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
required sequence<GPUBindGroupLayoutBinding> bindings;
required sequence<GPUBindGroupLayoutEntry> bindings;
};
dictionary GPUBindGroupLayoutBinding {
dictionary GPUBindGroupLayoutEntry {
required GPUIndex32 binding;
required GPUShaderStageFlags visibility;
required GPUBindingType type;
GPUTextureViewDimension textureDimension = "2d";
GPUTextureViewDimension viewDimension = "2d";
GPUTextureComponentType textureComponentType = "float";
boolean multisampled = false;
boolean hasDynamicOffset = false;
GPUTextureFormat storageTextureFormat;
};
typedef [EnforceRange] unsigned long GPUShaderStageFlags;
@ -302,8 +303,10 @@ enum GPUBindingType {
"storage-buffer",
"readonly-storage-buffer",
"sampler",
"comparison-sampler",
"sampled-texture",
"storage-texture"
"readonly-storage-texture",
"writeonly-storage-texture"
// TODO: other binding types
};
@ -313,12 +316,12 @@ GPUBindGroup includes GPUObjectBase;
dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase {
required GPUBindGroupLayout layout;
required sequence<GPUBindGroupBinding> bindings;
required sequence<GPUBindGroupEntry> bindings;
};
typedef (GPUSampler or GPUTextureView or GPUBufferBinding) GPUBindingResource;
dictionary GPUBindGroupBinding {
dictionary GPUBindGroupEntry {
required GPUIndex32 binding;
required GPUBindingResource resource;
};
@ -342,10 +345,8 @@ interface GPUShaderModule {
};
GPUShaderModule includes GPUObjectBase;
typedef (Uint32Array or DOMString) GPUShaderCode;
dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
required GPUShaderCode code;
required DOMString code;
};
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
@ -604,7 +605,7 @@ dictionary GPUBufferCopyView {
required GPUBuffer buffer;
GPUSize64 offset = 0;
required GPUSize32 rowPitch;
required GPUSize32 imageHeight;
GPUSize32 imageHeight = 0;
};
dictionary GPUTextureCopyView {