Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest WebGPU WebIDL #2037

Merged
merged 1 commit into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ Gpu = []
GpuAdapter = []
GpuAddressMode = []
GpuBindGroup = []
GpuBindGroupBinding = []
GpuBindGroupDescriptor = []
GpuBindGroupEntry = []
GpuBindGroupLayout = []
GpuBindGroupLayoutBinding = []
GpuBindGroupLayoutDescriptor = []
GpuBindGroupLayoutEntry = []
GpuBindingType = []
GpuBlendDescriptor = []
GpuBlendFactor = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)*"]
Expand All @@ -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)*"]
Expand All @@ -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)*"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)*"]
Expand All @@ -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)*"]
Expand All @@ -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)*"]
Expand All @@ -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)*"]
Expand All @@ -95,18 +95,18 @@ impl GpuBindGroupLayoutBinding {
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureComponentType")]
#[doc = "Change the `textureComponentType` field of this object."]
#[cfg(feature = "GpuTextureFormat")]
#[doc = "Change the `storageTextureFormat` 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`, `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 texture_component_type(&mut self, val: GpuTextureComponentType) -> &mut Self {
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("textureComponentType"),
&JsValue::from("storageTextureFormat"),
&JsValue::from(val),
);
debug_assert!(
Expand All @@ -117,18 +117,18 @@ impl GpuBindGroupLayoutBinding {
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureViewDimension")]
#[doc = "Change the `textureDimension` field of this object."]
#[cfg(feature = "GpuTextureComponentType")]
#[doc = "Change the `textureComponentType` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutBinding`, `GpuTextureViewDimension`*"]
#[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)*"]
pub fn texture_dimension(&mut self, val: GpuTextureViewDimension) -> &mut Self {
pub fn texture_component_type(&mut self, val: GpuTextureComponentType) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("textureDimension"),
&JsValue::from("textureComponentType"),
&JsValue::from(val),
);
debug_assert!(
Expand All @@ -142,7 +142,7 @@ impl GpuBindGroupLayoutBinding {
#[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)*"]
Expand All @@ -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)*"]
Expand Down
4 changes: 3 additions & 1 deletion crates/web-sys/src/features/gen_GpuBindingType.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
3 changes: 1 addition & 2 deletions crates/web-sys/src/features/gen_GpuBufferCopyView.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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!(
Expand Down
24 changes: 12 additions & 12 deletions crates/web-sys/src/features/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 12 additions & 11 deletions crates/web-sys/webidls/unstable/WebGPU.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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
};

Expand All @@ -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;
};
Expand All @@ -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 {
Expand Down Expand Up @@ -604,7 +605,7 @@ dictionary GPUBufferCopyView {
required GPUBuffer buffer;
GPUSize64 offset = 0;
required GPUSize32 rowPitch;
required GPUSize32 imageHeight;
GPUSize32 imageHeight = 0;
};

dictionary GPUTextureCopyView {
Expand Down