Skip to content

Commit

Permalink
Update WebGPU API to draft 2024-10-07
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Oct 8, 2024
1 parent 98c5e0b commit 4d71ea3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
* Changed `TextDecoder.decode()` `input` parameter type from `&mut [u8]` to `&[u8]`.
[#4141](https://github.com/rustwasm/wasm-bindgen/pull/4141)

* Updated the WebGPU API to the current draft as of 2024-10-07.
[#4145](https://github.com/rustwasm/wasm-bindgen/pull/4145)

### Fixed

* Fixed linked modules emitting snippet files when not using `--split-linked-modules`.
Expand Down
15 changes: 8 additions & 7 deletions crates/web-sys/webidls/unstable/WebGPU.webidl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// https://www.w3.org/TR/2024/WD-webgpu-20241007/

interface mixin GPUObjectBase {
attribute USVString label;
};
Expand Down Expand Up @@ -30,7 +32,6 @@ interface GPUSupportedLimits {
readonly attribute unsigned long long maxBufferSize;
readonly attribute unsigned long maxVertexAttributes;
readonly attribute unsigned long maxVertexBufferArrayStride;
readonly attribute unsigned long maxInterStageShaderComponents;
readonly attribute unsigned long maxInterStageShaderVariables;
readonly attribute unsigned long maxColorAttachments;
readonly attribute unsigned long maxColorAttachmentBytesPerSample;
Expand Down Expand Up @@ -74,6 +75,7 @@ interface GPU {
};

dictionary GPURequestAdapterOptions {
DOMString featureLevel;
GPUPowerPreference powerPreference;
boolean forceFallbackAdapter = false;
};
Expand All @@ -91,14 +93,12 @@ interface GPUAdapter {
readonly attribute boolean isFallbackAdapter;

Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
[RustDeprecated]
Promise<GPUAdapterInfo> requestAdapterInfo();
};

dictionary GPUDeviceDescriptor
: GPUObjectDescriptorBase {
sequence<GPUFeatureName> requiredFeatures = [];
record<DOMString, GPUSize64> requiredLimits = {};
record<DOMString, (GPUSize64 or undefined)> requiredLimits = {};
GPUQueueDescriptor defaultQueue = {};
};

Expand All @@ -109,6 +109,7 @@ enum GPUFeatureName {
"texture-compression-bc-sliced-3d",
"texture-compression-etc2",
"texture-compression-astc",
"texture-compression-astc-sliced-3d",
"timestamp-query",
"indirect-first-instance",
"shader-f16",
Expand Down Expand Up @@ -141,7 +142,6 @@ interface GPUDevice : EventTarget {
GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor);

[Throws]
GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
[Throws]
Expand Down Expand Up @@ -263,6 +263,7 @@ dictionary GPUTextureViewDescriptor
: GPUObjectDescriptorBase {
GPUTextureFormat format;
GPUTextureViewDimension dimension;
GPUTextureUsageFlags usage = 0;
GPUTextureAspect aspect = "all";
GPUIntegerCoordinate baseMipLevel = 0;
GPUIntegerCoordinate mipLevelCount;
Expand Down Expand Up @@ -586,7 +587,6 @@ GPUShaderModule includes GPUObjectBase;
dictionary GPUShaderModuleDescriptor
: GPUObjectDescriptorBase {
required USVString code;
object sourceMap;
sequence<GPUShaderModuleCompilationHint> compilationHints = [];
};

Expand Down Expand Up @@ -647,7 +647,7 @@ interface mixin GPUPipelineBase {
dictionary GPUProgrammableStage {
required GPUShaderModule module;
USVString entryPoint;
record<USVString, GPUPipelineConstantValue> constants;
record<USVString, GPUPipelineConstantValue> constants = {};
};

typedef double GPUPipelineConstantValue; // May represent WGSL's bool, f32, i32, u32, and f16 if enabled.
Expand Down Expand Up @@ -1199,6 +1199,7 @@ interface GPUCanvasContext {
undefined configure(GPUCanvasConfiguration configuration);
undefined unconfigure();

GPUCanvasConfiguration? getConfiguration();
[Throws]
GPUTexture getCurrentTexture();
};
Expand Down

0 comments on commit 4d71ea3

Please sign in to comment.