diff --git a/README.md b/README.md
index ee63dc64..b7a718d2 100644
--- a/README.md
+++ b/README.md
@@ -98,7 +98,6 @@ Most or all of these should be fixed in the generator over time.
- `Array` changed to `Iterable` for WebIDL `sequence`s in argument positions (but not in return positions).
- `any` changed to `object` for WebIDL `object`.
-- `| SharedArrayBuffer` added for `[AllowShared] BufferSource`.
- `| null` changed to `| null | undefined` for WebIDL nullable items (`T?`).
The following differences are TODO: should be changed in the final result.
@@ -109,6 +108,7 @@ The following differences are TODO: should be changed in the final result.
The following differences will remain.
- `onuncapturederror` strongly typed.
+- `addEventListener('uncapturederror')` type support.
- `getContext` definitions.
- `GPUExtent3DStrict` and `GPUOrigin2DStrict`.
diff --git a/dist/index.d.ts b/dist/index.d.ts
index b184bedc..9a5bf5b2 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -524,7 +524,8 @@ interface GPUBindGroupLayoutEntry {
storageTexture?: GPUStorageTextureBindingLayout;
/**
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
- * is {@link GPUExternalTexture}.
+ * is either {@link GPUExternalTexture} or {@link GPUTextureView}.
+ * External textures use several binding slots: see Exceeds the binding slot limits.
*/
externalTexture?: GPUExternalTextureBindingLayout;
}
@@ -1069,6 +1070,48 @@ interface GPUProgrammableStage {
* Values are specified as GPUPipelineConstantValue, which is a {@link double}.
* They are converted [$to WGSL type$] of the pipeline-overridable constant (`bool`/`i32`/`u32`/`f32`/`f16`).
* If conversion fails, a validation error is generated.
+ *
+ * Pipeline-overridable constants defined in WGSL:
+ *
+ * @id(0) override has_point_light: bool = true; // Algorithmic control.
+ * @id(1200) override specular_param: f32 = 2.3; // Numeric control.
+ * @id(1300) override gain: f32; // Must be overridden.
+ * override width: f32 = 0.0; // Specifed at the API level
+ * // using the name "width".
+ * override depth: f32; // Specifed at the API level
+ * // using the name "depth".
+ * // Must be overridden.
+ * override height = 2 * depth; // The default value
+ * // (if not set at the API level),
+ * // depends on another
+ * // overridable constant.
+ *
+ * Corresponding JavaScript code, providing only the overrides which are required
+ * (have no defaults):
+ *
+ * {
+ * // ...
+ * constants: {
+ * 1300: 2.0, // "gain"
+ * depth: -1, // "depth"
+ * }
+ * }
+ *
+ * Corresponding JavaScript code, overriding all constants:
+ *
+ * {
+ * // ...
+ * constants: {
+ * 0: false, // "has_point_light"
+ * 1200: 3.0, // "specular_param"
+ * 1300: 2.0, // "gain"
+ * width: 20, // "width"
+ * depth: -1, // "depth"
+ * height: 15, // "height"
+ * }
+ * }
+ *
+ *
*/
constants?: Record<
string,
@@ -1307,10 +1350,11 @@ interface GPURenderPipelineDescriptor
interface GPURequestAdapterOptions {
/**
* "Feature level" for the adapter request.
- * The allowed feature level string values are:
- * - `"core"`
+ * The allowed feature level string values are:
+ *
+ * : "core"
* No effect.
- * - `"compatibility"`
+ * : "compatibility"
* No effect.
* Note:
* This value is reserved for future use as a way to opt into additional validation restrictions.
@@ -1622,8 +1666,7 @@ interface GPUTextureDescriptor
*/
viewFormats?: Iterable;
/**
- * **PROPOSED** addition for Compatibility Mode:
- *
+ * **PROPOSED** in [Compatibility Mode](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md).
*
* > [In compatibility mode,]
* > When specifying a texture, a textureBindingViewDimension property
@@ -1987,7 +2030,7 @@ interface GPUAdapter {
/**
* Requests a device from the adapter.
* This is a one-time action: if a device is returned successfully,
- * the adapter becomes {@link adapter#[[state]]} "consumed".
+ * the adapter becomes {@link adapter#[[state]]#"consumed"}.
* @param descriptor - Description of the {@link GPUDevice} to request.
*/
requestDevice(
@@ -2222,6 +2265,14 @@ interface GPUCommandEncoder
beginComputePass(
descriptor?: GPUComputePassDescriptor
): GPUComputePassEncoder;
+ /**
+ * Shorthand, equivalent to {{GPUCommandEncoder/copyBufferToBuffer(source, sourceOffset, destination, destinationOffset, size)|copyBufferToBuffer(source, 0, destination, 0, size)}}.
+ */
+ copyBufferToBuffer(
+ source: GPUBuffer,
+ destination: GPUBuffer,
+ size?: GPUSize64
+ ): undefined;
/**
* Encode a command into the {@link GPUCommandEncoder} that copies data from a sub-region of a
* {@link GPUBuffer} to a sub-region of another {@link GPUBuffer}.
@@ -2898,9 +2949,7 @@ interface GPUQueue
writeBuffer(
buffer: GPUBuffer,
bufferOffset: GPUSize64,
- data:
- | BufferSource
- | SharedArrayBuffer,
+ data: AllowSharedBufferSource,
dataOffset?: GPUSize64,
size?: GPUSize64
): undefined;
@@ -2913,9 +2962,7 @@ interface GPUQueue
*/
writeTexture(
destination: GPUTexelCopyTextureInfo,
- data:
- | BufferSource
- | SharedArrayBuffer,
+ data: AllowSharedBufferSource,
dataLayout: GPUTexelCopyBufferLayout,
size: GPUExtent3DStrict
): undefined;
@@ -3174,9 +3221,13 @@ interface GPUSupportedLimits {
readonly maxComputeWorkgroupSizeY: number;
readonly maxComputeWorkgroupSizeZ: number;
readonly maxComputeWorkgroupsPerDimension: number;
+ /** **PROPOSED** in [Compatibility Mode](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md). */
readonly maxStorageBuffersInVertexStage?: number;
+ /** **PROPOSED** in [Compatibility Mode](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md). */
readonly maxStorageBuffersInFragmentStage?: number;
+ /** **PROPOSED** in [Compatibility Mode](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md). */
readonly maxStorageTexturesInVertexStage?: number;
+ /** **PROPOSED** in [Compatibility Mode](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md). */
readonly maxStorageTexturesInFragmentStage?: number;
}
diff --git a/generated/index.d.ts b/generated/index.d.ts
index f54b1430..8786701e 100644
--- a/generated/index.d.ts
+++ b/generated/index.d.ts
@@ -469,7 +469,8 @@ interface GPUBindGroupLayoutEntry {
storageTexture?: GPUStorageTextureBindingLayout;
/**
* When map/exist|provided, indicates the binding resource type for this {@link GPUBindGroupLayoutEntry}
- * is {@link GPUExternalTexture}.
+ * is either {@link GPUExternalTexture} or {@link GPUTextureView}.
+ * External textures use several binding slots: see Exceeds the binding slot limits.
*/
externalTexture?: GPUExternalTextureBindingLayout;
}
@@ -1813,7 +1814,6 @@ interface GPUAdapter {
readonly features: GPUSupportedFeatures;
readonly limits: GPUSupportedLimits;
readonly info: GPUAdapterInfo;
- readonly isFallbackAdapter: boolean;
/**
* Requests a device from the adapter.
* This is a one-time action: if a device is returned successfully,
@@ -1842,6 +1842,7 @@ interface GPUAdapterInfo {
readonly description: string;
readonly subgroupMinSize: number;
readonly subgroupMaxSize: number;
+ readonly isFallbackAdapter: boolean;
}
declare var GPUAdapterInfo: {
@@ -2009,6 +2010,14 @@ interface GPUCommandEncoder
beginComputePass(
descriptor?: GPUComputePassDescriptor
): GPUComputePassEncoder;
+ /**
+ * Shorthand, equivalent to {{GPUCommandEncoder/copyBufferToBuffer(source, sourceOffset, destination, destinationOffset, size)|copyBufferToBuffer(source, 0, destination, 0, size)}}.
+ */
+ copyBufferToBuffer(
+ source: GPUBuffer,
+ destination: GPUBuffer,
+ size?: GPUSize64
+ ): undefined;
/**
* Encode a command into the {@link GPUCommandEncoder} that copies data from a sub-region of a
* {@link GPUBuffer} to a sub-region of another {@link GPUBuffer}.
@@ -2023,7 +2032,7 @@ interface GPUCommandEncoder
sourceOffset: GPUSize64,
destination: GPUBuffer,
destinationOffset: GPUSize64,
- size: GPUSize64
+ size?: GPUSize64
): undefined;
/**
* Encode a command into the {@link GPUCommandEncoder} that copies data from a sub-region of a
diff --git a/gpuweb b/gpuweb
index 859fdd4a..a9eee1b4 160000
--- a/gpuweb
+++ b/gpuweb
@@ -1 +1 @@
-Subproject commit 859fdd4a803a11e7b8de70483aa75c365be18b0e
+Subproject commit a9eee1b45c939a48cb6b7fc28ee1394644349391
diff --git a/tests/ts5.1/index.ts b/tests/ts5.2/index.ts
similarity index 100%
rename from tests/ts5.1/index.ts
rename to tests/ts5.2/index.ts
diff --git a/tests/ts5.1/package.json b/tests/ts5.2/package.json
similarity index 81%
rename from tests/ts5.1/package.json
rename to tests/ts5.2/package.json
index 9af1ac54..eb0e60b5 100644
--- a/tests/ts5.1/package.json
+++ b/tests/ts5.2/package.json
@@ -4,6 +4,6 @@
},
"dependencies": {
"@webgpu/types": "file:../..",
- "typescript": "~5.1.0"
+ "typescript": "~5.2.0"
}
}
diff --git a/tests/ts5.1/tsconfig.json b/tests/ts5.2/tsconfig.json
similarity index 100%
rename from tests/ts5.1/tsconfig.json
rename to tests/ts5.2/tsconfig.json
diff --git a/tests/ts5.8/index.ts b/tests/ts5.8/index.ts
new file mode 100644
index 00000000..cbd44f35
--- /dev/null
+++ b/tests/ts5.8/index.ts
@@ -0,0 +1 @@
+///
diff --git a/tests/ts5.8/package.json b/tests/ts5.8/package.json
new file mode 100644
index 00000000..11225a45
--- /dev/null
+++ b/tests/ts5.8/package.json
@@ -0,0 +1,9 @@
+{
+ "scripts": {
+ "test": "tsc --version && tsc"
+ },
+ "dependencies": {
+ "@webgpu/types": "file:../..",
+ "typescript": "~5.8.0"
+ }
+}
diff --git a/tests/ts5.8/tsconfig.json b/tests/ts5.8/tsconfig.json
new file mode 100644
index 00000000..bf97df0a
--- /dev/null
+++ b/tests/ts5.8/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "extends": "../tsconfig.json",
+ "include": ["index.ts"]
+}
diff --git a/tsdoc-src/generate-webgpu-ts.mjs b/tsdoc-src/generate-webgpu-ts.mjs
index e09837e9..e39ccdd3 100644
--- a/tsdoc-src/generate-webgpu-ts.mjs
+++ b/tsdoc-src/generate-webgpu-ts.mjs
@@ -9,8 +9,8 @@ async function main() {
// export types
.replace(/\ntype /g, '\nexport type ')
- // {{GPUAddressMode|address modes}} => {@link GPUAddressMode | address modes}
- .replace(/\{\{GPUAddressMode\|address modes\}\}/g, '{@link GPUAddressMode | address modes}')
+ // {{ref|text}} => {@link ref | text}
+ .replace(/\{\{([^}|]+)\|([^}|]+)\}\}/g, '{@link $1 | $2}')
// fix links of the form {@link foo|caption} -> {@link foo | caption}
.replace(/\{@link([^}]+)\S\|\S(.*?)\}/g, `{@link $1 | $2}`)
@@ -19,7 +19,10 @@ async function main() {
.replace(/\{@link([^[}]+)\[\[(.*?)]]}/g, `{@link $1$2}`)
// convert [[link]] to {@link link}
- .replace(/\[\[([^\[].*?)\]\]/g, '{@link https://www.w3.org/TR/webgpu/$1}')
+ .replace(/([^#])\[\[([^\[].*?)\]\]/g, '$1{@link https://www.w3.org/TR/webgpu/$2}')
+
+ .replace(//g, '```$1')
+ .replace(/<\/pre>/g, '```')
// remove __brand
.replace(new RegExp(`/\\*\\*