From 5875d1542cd663417b6beb16f7542aa164f24b56 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 2 Dec 2025 16:08:15 -0800 Subject: [PATCH 1/7] Roll gpuweb --- generated/index.d.ts | 54 ++++++++++++++++++++++++++++++++++++-------- gpuweb | 2 +- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/generated/index.d.ts b/generated/index.d.ts index a3dbf9a0..b2d360f3 100644 --- a/generated/index.d.ts +++ b/generated/index.d.ts @@ -675,7 +675,7 @@ interface GPUBufferBinding { interface GPUBufferBindingLayout { /** - * Indicates the type required for buffers bound to this bindings. + * Indicates the type required for buffers bound to this binding. */ type?: GPUBufferBindingType; /** @@ -1450,16 +1450,35 @@ interface GPURenderPipelineDescriptor interface GPURequestAdapterOptions { /** - * "Feature level" for the adapter request. + * Requests an adapter that supports at least a particular set of capabilities. + * This influences the {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} of devices created + * from this adapter. The capabilities for each level are defined below, and the exact + * steps are defined in {@link GPU#requestAdapter} and "a new device". + * If the implementation or system does not support all of the capabilities in the + * requested feature level, {@link GPU#requestAdapter} will return `null`. + * Note: + * Applications should typically make a single {@link GPU#requestAdapter} call with the lowest + * feature level they support, then inspect the adapter for additional capabilities they can + * use optionally, and request those in {@link GPUAdapter#requestDevice}. * The allowed feature level string values are: *
* : "core" - * No effect. + * The following set of capabilities: + * - The limit/Default limits. + * - {@link GPUFeatureName} `"core-features-and-limits"`. + * Note: + * Adapters with this {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} may + * conventionally be referred to as "Core-defaulting". * : "compatibility" - * No effect. + * The following set of capabilities: + * - The limit/Compatibility Mode Default limits. + * - No features. (It excludes the {@link GPUFeatureName} `"core-features-and-limits"` feature.) + * If the implementation cannot enforce the stricter "Compatibility Mode" + * validation rules, {@link GPU#requestAdapter} will ignore this request and + * treat it as a request for feature level string/"core". * Note: - * This value is reserved for future use as a way to opt into additional validation restrictions. - * Applications should not use this value at this time. + * Adapters with this {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} may + * conventionally be referred to as "Compatibility-defaulting". */ featureLevel?: string; powerPreference?: GPUPowerPreference; @@ -1469,7 +1488,7 @@ interface GPURequestAdapterOptions { interface GPUSamplerBindingLayout { /** - * Indicates the required type of a sampler bound to this bindings. + * Indicates the required type of a sampler bound to this binding. */ type?: GPUSamplerBindingType; } @@ -1731,12 +1750,22 @@ interface GPUTextureDescriptor * * Formats in this list must be texture view format compatible with the texture format. *
- * Two {@link GPUTextureFormat}s `format` and `viewFormat` are texture view format compatible if: + * Two {@link GPUTextureFormat}s `format` and `viewFormat` are texture view format compatible on a given `device` if: * - `format` equals `viewFormat`, or - * - `format` and `viewFormat` differ only in whether they are `srgb` formats (have the `-srgb` suffix). + * - `format` and `viewFormat` differ only in whether they are `srgb` formats (have the `-srgb` suffix) and `device.features` list/contains {@link GPUFeatureName} `"core-features-and-limits"`. *
*/ viewFormats?: Iterable; + /** + *
+ * On devices without {@link GPUFeatureName} `"core-features-and-limits"`, + * views created from this texture must have this as their {@link GPUTextureViewDescriptor#dimension}. + * If not specified, a default is chosen. + *
+ * On devices with {@link GPUFeatureName} `"core-features-and-limits"`, + * this is ignored, and there is no such restriction. + */ + textureBindingViewDimension?: GPUTextureViewDimension; } interface GPUTextureViewDescriptor @@ -2910,7 +2939,11 @@ interface GPUSupportedLimits { readonly maxSampledTexturesPerShaderStage: number; readonly maxSamplersPerShaderStage: number; readonly maxStorageBuffersPerShaderStage: number; + readonly maxStorageBuffersInVertexStage: number; + readonly maxStorageBuffersInFragmentStage: number; readonly maxStorageTexturesPerShaderStage: number; + readonly maxStorageTexturesInVertexStage: number; + readonly maxStorageTexturesInFragmentStage: number; readonly maxUniformBuffersPerShaderStage: number; readonly maxUniformBufferBindingSize: number; readonly maxStorageBufferBindingSize: number; @@ -2959,6 +2992,9 @@ interface GPUTexture readonly dimension: GPUTextureDimension; readonly format: GPUTextureFormat; readonly usage: GPUFlagsConstant; + readonly textureBindingViewDimension: + | GPUTextureViewDimension + | undefined; } declare var GPUTexture: { diff --git a/gpuweb b/gpuweb index 423b28bf..630ca2ae 160000 --- a/gpuweb +++ b/gpuweb @@ -1 +1 @@ -Subproject commit 423b28bfdf8ac2e5307ef0b6e0e68d6d14c2d3bd +Subproject commit 630ca2ae057701eb55c5bdf7a26efdb023e8d154 From 48d4551b4514805272825c93fbacd085a08cc32d Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 2 Dec 2025 16:08:41 -0800 Subject: [PATCH 2/7] Sync generated docs --- dist/index.d.ts | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 7565bb16..5cb722f2 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -675,7 +675,7 @@ interface GPUBufferBinding { interface GPUBufferBindingLayout { /** - * Indicates the type required for buffers bound to this bindings. + * Indicates the type required for buffers bound to this binding. */ type?: GPUBufferBindingType; /** @@ -1455,16 +1455,35 @@ interface GPURenderPipelineDescriptor interface GPURequestAdapterOptions { /** - * "Feature level" for the adapter request. + * Requests an adapter that supports at least a particular set of capabilities. + * This influences the {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} of devices created + * from this adapter. The capabilities for each level are defined below, and the exact + * steps are defined in {@link GPU#requestAdapter} and "a new device". + * If the implementation or system does not support all of the capabilities in the + * requested feature level, {@link GPU#requestAdapter} will return `null`. + * Note: + * Applications should typically make a single {@link GPU#requestAdapter} call with the lowest + * feature level they support, then inspect the adapter for additional capabilities they can + * use optionally, and request those in {@link GPUAdapter#requestDevice}. * The allowed feature level string values are: *
* : "core" - * No effect. + * The following set of capabilities: + * - The limit/Default limits. + * - {@link GPUFeatureName} `"core-features-and-limits"`. + * Note: + * Adapters with this {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} may + * conventionally be referred to as "Core-defaulting". * : "compatibility" - * No effect. + * The following set of capabilities: + * - The limit/Compatibility Mode Default limits. + * - No features. (It excludes the {@link GPUFeatureName} `"core-features-and-limits"` feature.) + * If the implementation cannot enforce the stricter "Compatibility Mode" + * validation rules, {@link GPU#requestAdapter} will ignore this request and + * treat it as a request for feature level string/"core". * Note: - * This value is reserved for future use as a way to opt into additional validation restrictions. - * Applications should not use this value at this time. + * Adapters with this {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} may + * conventionally be referred to as "Compatibility-defaulting". */ featureLevel?: string; /** @@ -1765,20 +1784,20 @@ interface GPUTextureDescriptor * * Formats in this list must be texture view format compatible with the texture format. *
- * Two {@link GPUTextureFormat}s `format` and `viewFormat` are texture view format compatible if: + * Two {@link GPUTextureFormat}s `format` and `viewFormat` are texture view format compatible on a given `device` if: * - `format` equals `viewFormat`, or - * - `format` and `viewFormat` differ only in whether they are `srgb` formats (have the `-srgb` suffix). + * - `format` and `viewFormat` differ only in whether they are `srgb` formats (have the `-srgb` suffix) and `device.features` list/contains {@link GPUFeatureName} `"core-features-and-limits"`. *
*/ viewFormats?: Iterable; /** - * **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 - * > determines the views which can be bound from that texture for sampling. - * > Binding a view of a different dimension for sampling than specified at - * > texture creation time will cause a validation error. + *
+ * On devices without {@link GPUFeatureName} `"core-features-and-limits"`, + * views created from this texture must have this as their {@link GPUTextureViewDescriptor#dimension}. + * If not specified, a default is chosen. + *
+ * On devices with {@link GPUFeatureName} `"core-features-and-limits"`, + * this is ignored, and there is no such restriction. */ textureBindingViewDimension?: GPUTextureViewDimension; } From 9aa1fcda081d969fd500769a4f12137f9e9fd6a7 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 2 Dec 2025 16:32:33 -0800 Subject: [PATCH 3/7] Fixes for generated docs --- dist/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 5cb722f2..66aed953 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1456,7 +1456,7 @@ interface GPURenderPipelineDescriptor interface GPURequestAdapterOptions { /** * Requests an adapter that supports at least a particular set of capabilities. - * This influences the {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} of devices created + * This influences the {@link adapter#[[default feature level]]} of devices created * from this adapter. The capabilities for each level are defined below, and the exact * steps are defined in {@link GPU#requestAdapter} and "a new device". * If the implementation or system does not support all of the capabilities in the @@ -1472,7 +1472,7 @@ interface GPURequestAdapterOptions { * - The limit/Default limits. * - {@link GPUFeatureName} `"core-features-and-limits"`. * Note: - * Adapters with this {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} may + * Adapters with this {@link adapter#[[default feature level]]} may * conventionally be referred to as "Core-defaulting". * : "compatibility" * The following set of capabilities: @@ -1482,7 +1482,7 @@ interface GPURequestAdapterOptions { * validation rules, {@link GPU#requestAdapter} will ignore this request and * treat it as a request for feature level string/"core". * Note: - * Adapters with this {@link adapter/{@link https://www.w3.org/TR/webgpu/default feature level}} may + * Adapters with this {@link adapter#[[default feature level]]} may * conventionally be referred to as "Compatibility-defaulting". */ featureLevel?: string; From 920c584fdebb129a8b7a9982cbd422f83184136a Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 2 Dec 2025 16:09:23 -0800 Subject: [PATCH 4/7] Fixes for immediates --- dist/index.d.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 66aed953..fb90fb31 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1098,9 +1098,10 @@ interface GPUPipelineLayoutDescriptor | null | undefined >; - /** * The size in bytes of the immediate data range. + * + * **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). */ immediateSize?: GPUSize32; } @@ -1956,8 +1957,10 @@ interface GPUBindingCommandsMixin { * `data` is a `TypedArray` and bytes otherwise. Defaults to 0. * @param size - Size of content to write from `data` to `buffer`. Given in elements if * `data` is a `TypedArray` and bytes otherwise. + * + * **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). */ - setImmediates( + setImmediates?( rangeOffset: GPUSize32, data: GPUAllowSharedBufferSource, dataOffset?: GPUSize64, @@ -2210,14 +2213,14 @@ interface GPUAdapterInfo { * If the "subgroups" feature is supported, the minimum supported subgroup size for the * adapter. * - * TODO: Temporarily optional until all browsers have implemented it. + * @todo Temporarily optional until all browsers have implemented it. */ readonly subgroupMinSize?: number; /** * If the "subgroups" feature is supported, the maximum supported subgroup size for the * adapter. * - * TODO: Temporarily optional until all browsers have implemented it. + * @todo Temporarily optional until all browsers have implemented it. */ readonly subgroupMaxSize?: number; /** @@ -3214,7 +3217,7 @@ interface GPUSupportedLimits { readonly maxComputeWorkgroupSizeZ: number; readonly maxComputeWorkgroupsPerDimension: number; /** **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). */ - readonly maxImmediateSize: number; + readonly maxImmediateSize?: 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). */ From bb15f36cc95e4126b0e8a578dcb3d88656a0d689 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 2 Dec 2025 16:20:26 -0800 Subject: [PATCH 5/7] Fixes for Compat --- dist/index.d.ts | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index fb90fb31..10187b6d 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -3197,7 +3197,15 @@ interface GPUSupportedLimits { readonly maxSampledTexturesPerShaderStage: number; readonly maxSamplersPerShaderStage: number; readonly maxStorageBuffersPerShaderStage: number; + /** @todo Temporarily optional until all browsers have implemented it. */ + readonly maxStorageBuffersInVertexStage?: number; + /** @todo Temporarily optional until all browsers have implemented it. */ + readonly maxStorageBuffersInFragmentStage?: number; readonly maxStorageTexturesPerShaderStage: number; + /** @todo Temporarily optional until all browsers have implemented it. */ + readonly maxStorageTexturesInVertexStage?: number; + /** @todo Temporarily optional until all browsers have implemented it. */ + readonly maxStorageTexturesInFragmentStage?: number; readonly maxUniformBuffersPerShaderStage: number; readonly maxUniformBufferBindingSize: number; readonly maxStorageBufferBindingSize: number; @@ -3218,14 +3226,6 @@ interface GPUSupportedLimits { readonly maxComputeWorkgroupsPerDimension: number; /** **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). */ readonly maxImmediateSize?: 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; } declare var GPUSupportedLimits: { @@ -3280,6 +3280,18 @@ interface GPUTexture * The allowed usages for this {@link GPUTexture}. */ readonly usage: GPUFlagsConstant; + /** + * On devices without "core-features-and-limits", views created from this + * texture must have this as their dimension. + * + * On devices with "core-features-and-limits", this is undefined, and there is + * no such restriction. + * + * @todo Temporarily optional until all browsers have implemented it. + */ + readonly textureBindingViewDimension?: + | GPUTextureViewDimension + | undefined; } declare var GPUTexture: { From 51f04230269fced74c1f55f73d26d04edbc11fe7 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 2 Dec 2025 16:37:22 -0800 Subject: [PATCH 6/7] Add note on how to use optional things --- dist/index.d.ts | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 10187b6d..a8e64644 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1102,6 +1102,7 @@ interface GPUPipelineLayoutDescriptor * The size in bytes of the immediate data range. * * **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). + * Check support before using. (Use the non-null assertion operator `!` where needed.) */ immediateSize?: GPUSize32; } @@ -1959,6 +1960,7 @@ interface GPUBindingCommandsMixin { * `data` is a `TypedArray` and bytes otherwise. * * **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). + * Check support before using. (Use the non-null assertion operator `!` where needed.) */ setImmediates?( rangeOffset: GPUSize32, @@ -2214,6 +2216,7 @@ interface GPUAdapterInfo { * adapter. * * @todo Temporarily optional until all browsers have implemented it. + * Check support before using. (Use the non-null assertion operator `!` where needed.) */ readonly subgroupMinSize?: number; /** @@ -2221,6 +2224,7 @@ interface GPUAdapterInfo { * adapter. * * @todo Temporarily optional until all browsers have implemented it. + * Check support before using. (Use the non-null assertion operator `!` where needed.) */ readonly subgroupMaxSize?: number; /** @@ -3197,14 +3201,26 @@ interface GPUSupportedLimits { readonly maxSampledTexturesPerShaderStage: number; readonly maxSamplersPerShaderStage: number; readonly maxStorageBuffersPerShaderStage: number; - /** @todo Temporarily optional until all browsers have implemented it. */ + /** + * @todo Temporarily optional until all browsers have implemented it. + * Check support before using. (Use the non-null assertion operator `!` where needed.) + */ readonly maxStorageBuffersInVertexStage?: number; - /** @todo Temporarily optional until all browsers have implemented it. */ + /** + * @todo Temporarily optional until all browsers have implemented it. + * Check support before using. (Use the non-null assertion operator `!` where needed.) + */ readonly maxStorageBuffersInFragmentStage?: number; readonly maxStorageTexturesPerShaderStage: number; - /** @todo Temporarily optional until all browsers have implemented it. */ + /** + * @todo Temporarily optional until all browsers have implemented it. + * Check support before using. (Use the non-null assertion operator `!` where needed.) + */ readonly maxStorageTexturesInVertexStage?: number; - /** @todo Temporarily optional until all browsers have implemented it. */ + /** + * @todo Temporarily optional until all browsers have implemented it. + * Check support before using. (Use the non-null assertion operator `!` where needed.) + */ readonly maxStorageTexturesInFragmentStage?: number; readonly maxUniformBuffersPerShaderStage: number; readonly maxUniformBufferBindingSize: number; @@ -3224,7 +3240,10 @@ interface GPUSupportedLimits { readonly maxComputeWorkgroupSizeY: number; readonly maxComputeWorkgroupSizeZ: number; readonly maxComputeWorkgroupsPerDimension: number; - /** **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). */ + /** + * **PROPOSED** in [Immediates](https://github.com/gpuweb/gpuweb/pull/5423). + * Check support before using. (Use the non-null assertion operator `!` where needed.) + */ readonly maxImmediateSize?: number; } @@ -3288,6 +3307,7 @@ interface GPUTexture * no such restriction. * * @todo Temporarily optional until all browsers have implemented it. + * Check support before using. (Use the non-null assertion operator `!` where needed.) */ readonly textureBindingViewDimension?: | GPUTextureViewDimension From 210027df705449d24c0c6dcfe2b4fe6a119e339b Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Fri, 12 Dec 2025 17:50:41 -0800 Subject: [PATCH 7/7] Fix comment on GPUTexture.textureBindingViewDimension --- dist/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index a8e64644..4d1fa52a 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -3307,7 +3307,10 @@ interface GPUTexture * no such restriction. * * @todo Temporarily optional until all browsers have implemented it. - * Check support before using. (Use the non-null assertion operator `!` where needed.) + * It is safe to access on any browser, as it will just (correctly) return + * `undefined` if not implemented. Note, depending on the device, `undefined` + * is a valid value even in browsers that implement this attribute. (So be + * careful if using the non-null assertion operator `!` on this.) */ readonly textureBindingViewDimension?: | GPUTextureViewDimension