这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@SenorBlanco
Copy link
Contributor

Land Compatibility Mode specification changes.

SenorBlanco and others added 27 commits June 4, 2025 11:36
Give definitions for the "core" and "compatibility" featureLevels, as
well as "Core-defaulting" and "Compatibility-defaulting" Adapters
(language largely taken from the compat proposal).

Define CSS for "Compatibility Mode" exceptions: a cyan-ish box, similar
to the "Valid Usage" styling.
As an example, add restriction 2 ("Color blending state may not differ
between color attachments in a `GPUFragmentState`.") from the compat
proposal in that style.

Co-authored-by: Kai Ninomiya <kainino@chromium.org>
Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Prohibit copyTextureToBuffer from compressed textures.
Prohibit copyTextureToTexture where either source or destination is a compressed format.
(copyBufferToTexture copies are ok.)

This is restriction #3 from the compat proposal.
`GPUTextureViewDescriptor.dimension` must not be `"cube-array"` in
Compatibility Mode (issue #4 from the compatibility-mode proposal).
At bind group creation time, validate that texture views contain all
array layers (view.baseArrayLayer == 0, view.arrayLayerCount ==
texture.depthOrArrayLayers).

This is [restriction
#6](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#6-array-texture-views-used-in-bind-groups-must-consist-of-the-entire-array-that-is-basearraylayer-must-be-zero-and-arraylayercount-must-be-equal-to-the-size-of-the-texture-array)
from the compatibility-mode proposal.
Prevent the use of rg32float, rg32sint, and rg32unit as STORAGE_BINDING
in Compatibility Mode.

Remove the line about createShaderModule() validation, since it's
unnecessary.

This is [restriction
#8](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#8-disallow-two-component-rg-texture-formats-in-storage-texture-bindings)
in the Compatibility Mode proposal.

---------

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
During encoder bind group validation, validate that all
`GPUTextureViews` in all bind groups containing a reference to the same
`GPUTexture` must have matching `baseMipLevel`, `mipLevelCount`, and
`aspect`.

This validation represents [restriction
#5](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#5-views-of-the-same-texture-used-in-a-single-draw-may-not-differ-in-aspect-or-mip-levels)
in the Compatibility Mode proposal.

---------

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Co-authored-by: Kai Ninomiya <kainino@chromium.org>
GPUDepthStencilState.depthBiasClamp must be zero in Compat mode.

This represents [restriction
9](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#9-depth-bias-clamp-must-be-zero)
from the Compatibility Mode proposal.
Source and destination `sampleCount` must be 1.

This is [issue
#12](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#12-disallow-copying-multisample-textures)
in the Compatibility Mode proposal.

---------

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Add the Compatibility Mode limits to the limits table.

Increase the `colspan` of the full-width rows to match the new column
count (4 -> 5).
Implement the Compat validation of maxVertexAttributes, in which `vertex_index` and `instance_index` each consume a slot.
This represents [restriction
10](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#10-lower-limits)
from the compatibility-mode proposal.

---------

Co-authored-by: Mehmet Oguz Derin <mehmetoguzderin@mehmetoguzderin.com>
All members of viewFormats must be equal to the texture's format.

This is achieved by changing the definition of "texture view format
compatible" to be strict equality in Compatibility mode.

This corresponds to [restriction
13](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#13-disallow-texture-format-reinterpretation)
in the compatibility-mode proposal.

---------

Co-authored-by: Kai Ninomiya <kainino@chromium.org>
Sync compat feature branch for CI
Also modify the proposal doc to validate this at pipeline creation, not
shader module creation.

This represents issue
[7](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#7-disallow-sample_mask-and-sample_index-builtins-in-wgsl)
in the proposal doc.

---------

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Add `textureBindingViewDimension` to `GPUTexture` and `GPUTextureDescriptor`.

Implement the defaulting algorithm for
`GPUTextureDescriptor.textureBindingViewDimension`.
Implement Compat-specific validation in `createBindGroup()` validation.

---------

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Co-authored-by: Kai Ninomiya <kainino@chromium.org>
In Compatibility Mode, disallow interpolation type "linear", and
interpolation sampling "sample" and "first".
When interpolation type is "flat", allow only interpolation sampling
"either".

This represents restrictions

[11](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#11-disallow-linear-and-sample-interpolation-options)
and

[17](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#17-disallow-interpolationflat-and-interpolationflat-first)
in the compatibility-mode proposal.

---------

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Implement the depth texture restictions for Compatibility Mode:

- no `textureLoad()` of depth textures
- only comparison samplers with depth textures in texturing functions

This represents restrictions

[16](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#16-disallow-textureload-with-texture_depth-textures)
and

[20](https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#20-disallow-using-a-depth-texture-with-a-non-comparison-sampler)
from the compatibility-mode proposal.
Implement new storage buffer and texture limits.
    
Implement the new limits:
- maxStorageBuffersInVertexStage
- maxStorageBuffersInFragmentStage
- maxStorageTexturesInVertexStage
- maxStorageTexturesInFragmentStage
    
This represents restrictions

[18]https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#18-introduce-new-maxstoragebuffersinvertexstage-and-maxstoragetexturesinvertexstage-limits
and

[19]https://github.com/gpuweb/gpuweb/blob/main/proposals/compatibility-mode.md#19-introduce-new-maxstoragebuffersinfragmentstage-and-maxstoragetexturesinfragmentstage-limits
in the compatibility-mode proposal.
Following up on #5361, this PR adds
`swizzle` to the texture views match algorithm for compatibility mode.
Define an internal slot on the adapter for "default feature level".
Use it to store the requested feature level (if supported).
Use it to determine whether an adapter is "Core-defaulting" or "Compatibility-defaulting".
Set the "core-featres-and-limits" feature in the device as appropriate.

---------

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
@SenorBlanco SenorBlanco changed the title Featurebranch compat Implement Compatibility Mode Oct 20, 2025
@SenorBlanco SenorBlanco changed the title Implement Compatibility Mode Specify Compatibility Mode Oct 20, 2025
@SenorBlanco SenorBlanco requested a review from kainino0x October 20, 2025 21:44
@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

Previews, as seen when this build job started (b4d7456):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

kainino0x added a commit that referenced this pull request Oct 22, 2025
…5408)

This will minimize the Compat PR's diff (#5402), making it a bit easier
to review.

I'll merge this back and handle the merge conflict once it lands.
@kainino0x kainino0x added compat WebGPU Compatibility Mode api WebGPU API labels Oct 24, 2025
@kainino0x kainino0x changed the title Specify Compatibility Mode [main branch] Specify Compatibility Mode Oct 24, 2025
@jimblandy
Copy link
Contributor

minutes from API committee meeting 2025-10-29
  • SW: I’ve put a PR to merge compat mode into the main spec, KN has made some cleanups. Any concerns?
  • KN: It’s large, and needs review from the committee
  • TT: I haven’t had time to look at it yes, but I’ve looked at all the patches that landed on the branch, so it should be good
  • SW: There should not be any surprises. I previously brought up the issue of discovering the unique sampler/texture pairs. We glossed over that in the API spec, because it seems like it needs to be covered in the WGSL spec.
  • KN: It’s closely related to the algorithm we’re missing in the main spec. We already have sampler/texture pairing in the main spec, so compat is no worse.
  • JB: I think the algorithm we want for sampler/texture pairs is very close to the algorithm already in the WGSL spec for alias analysis, so we have a good example to follow when we do decide to fix that.
  • SW: Aside from that, no concerns.
  • Resolution: give TT a week to look over the final branch, but expect to merge.

@jimblandy jimblandy added this to WGSL Oct 29, 2025
@jimblandy jimblandy moved this to Current agenda in WGSL Oct 29, 2025
@jimblandy jimblandy removed this from WGSL Oct 29, 2025
@teoxoy
Copy link
Member

teoxoy commented Nov 3, 2025

I did a pass over all changes and how they map to the compat proposal, everything looks to be in; nice work! 🎉

|options|.{{GPURequestAdapterOptions/xrCompatible}}.
1. If |options|.{{GPURequestAdapterOptions/featureLevel}} is [=feature level string/"compatibility"=]:
1. Set |adapter|.{{adapter/[[default feature level]]}} to either [=feature level string/"compatibility"=]
or [=feature level string/"core"=] depending on whether the user agent supports Compatibility Mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's define "Compatibility Mode" as it currently lacks a definition.


Note: This is currently available on all adapters and enabled automatically on all devices even if not requested.
This is always available unless {{GPURequestAdapterOptions/featureLevel}} is set to [=feature level string/"compatibility"=],
in which case it may or may not be available (see there for information).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does see there for information mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this, I was referring to the featureLevel / "compatibility" links (which go to roughly the same place).

Suggested change
in which case it may or may not be available (see there for information).
in which case it may or may not be available (see those definitions for information).

@kainino0x kainino0x added this to the Milestone 2 milestone Nov 3, 2025
maxCombinationsPerStage is no longer used (issue 22).
If |t|.{{GPUObjectBase/[[device]]}}.{{device/[[features]]}} does not [=list/contain=] {{GPUFeatureName/"core-features-and-limits"}}:

1. If |descriptor|.{{GPUTextureDescriptor/textureBindingViewDimension}} is [=map/exist|provided=]:
1. Set |t|.{{GPUTexture/textureBindingViewDimension}} to |descriptor|.{{GPUTextureDescriptor/textureBindingViewDimension}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SenorBlanco Does setting GPUTexture textureBindingViewDimension in the content timeline means we'll have to duplicate the logic from Dawn? See https://source.chromium.org/chromium/chromium/src/+/main:third_party/dawn/src/dawn/native/Texture.cpp;l=983;drc=cf26374567ce19620a5cf3b82a1ed57dc7d36e4a

Copy link
Contributor

@kainino0x kainino0x Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed as #5432

If |t|.{{GPUObjectBase/[[device]]}}.{{device/[[features]]}} does not [=list/contain=] {{GPUFeatureName/"core-features-and-limits"}}:

1. If |descriptor|.{{GPUTextureDescriptor/textureBindingViewDimension}} is [=map/exist|provided=]:
1. Set |t|.{{GPUTexture/textureBindingViewDimension}} to |descriptor|.{{GPUTextureDescriptor/textureBindingViewDimension}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed the spec only sets t.textureBindingViewDimension if it's provided explicitly, and not if it's defaulted. Will need to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api WebGPU API compat WebGPU Compatibility Mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants