Skip to content

Update all sentinel values, reserve 0 #364

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

Merged
merged 6 commits into from
Oct 3, 2024

Conversation

kainino0x
Copy link
Collaborator

@kainino0x kainino0x commented Oct 3, 2024

Can be reviewed as separate commits.

  • Reorder fields in VertexBufferLayout so the sentinel slot is first (even though this doesn't match the upstream IDL)
  • Update BindingNotUsed/VertexBufferNotUsed enum values
  • Removing some Undefineds that don't need to exist
  • Reserved 0 in all enums without Undefined
  • Ordered some enums to match the spec

This is a bit different from the thing we previously discussed and agreed on:

  • I've swapped the values of BindingNotUsed=VertexBufferNotUsed=0 with Undefined=1 so that zero-init will trigger NotUsed. See Some enums' sentinel 0 values are indistinguishable from "undefined" defaulting #242 (comment)
  • I haven't introduced WGPUTextureFormat_ColorTargetNotUsed, opting to continue using WGPUTextureFormat_Undefined for this, because there's basically no chance that WGPUColorTargetState.format becomes optional. (Even if it did become "dynamic state" or something, I think we would use a different sentinel value than undefined in the JS API so that it had to be named explicitly.)

Fixes #234
Fixes #242
EDIT: also fixes #45
(done in Dawn except for the NotUsed changes: https://crbug.com/377820810)

@kainino0x kainino0x added the !discuss Needs discussion (at meeting or online) label Oct 3, 2024
@kainino0x kainino0x force-pushed the sentinels branch 2 times, most recently from 63154c8 to dba877e Compare October 3, 2024 03:08
@kainino0x
Copy link
Collaborator Author

@cwfitzgerald @rajveermalviya @Kangz see above about the things I did differently than what we discussed (no need to review fully but feel free). Let me know if you think any of those changes are not good.

@cwfitzgerald
Copy link
Collaborator

No notes here

@kainino0x kainino0x enabled auto-merge (rebase) October 3, 2024 18:18
@kainino0x kainino0x merged commit af63d34 into webgpu-native:main Oct 3, 2024
4 checks passed
@kainino0x kainino0x deleted the sentinels branch October 3, 2024 18:25
@kainino0x kainino0x removed the !discuss Needs discussion (at meeting or online) label Oct 3, 2024
copybara-service bot pushed a commit to google/dawn that referenced this pull request Nov 18, 2024
webgpu-native/webgpu-headers#364

Bug: 377820810
Change-Id: I541c24a84e076750d2a7cd1b8b786d2095509103
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/214854
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
copybara-service bot pushed a commit to google/dawn that referenced this pull request Nov 21, 2024
This CL renames current Undefined values to BindingNotUsed=0 (still the
default) for the following four enums:

- WGPUBufferBindingType
- WGPUSamplerBindingType
- WGPUTextureSampleType
- WGPUStorageTextureAccess

webgpu-native/webgpu-headers#364

Bug: 377820810
Change-Id: Id75bd9f05a78e8f08a319ef70050f45423f37e3d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/215114
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
copybara-service bot pushed a commit to google/dawn that referenced this pull request Nov 26, 2024
This reverts commit bcfc294.

Reason for revert: Fails Dawn -> Chromium Roll for MLDrift

Original change's description:
> webgpu.h: Update BindingNotUsed enum values | Part 1
>
> This CL renames current Undefined values to BindingNotUsed=0 (still the
> default) for the following four enums:
>
> - WGPUBufferBindingType
> - WGPUSamplerBindingType
> - WGPUTextureSampleType
> - WGPUStorageTextureAccess
>
> webgpu-native/webgpu-headers#364
>
> Bug: 377820810
> Change-Id: Id75bd9f05a78e8f08a319ef70050f45423f37e3d
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/215114
> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 377820810
Change-Id: I763de67cfb1fa6328c5b5cb5ebb3161e067e5ed9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/216774
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
copybara-service bot pushed a commit to google/dawn that referenced this pull request Dec 5, 2024
This is a reland of commit bcfc294

Original change's description:
> webgpu.h: Update BindingNotUsed enum values | Part 1
>
> This CL renames current Undefined values to BindingNotUsed=0 (still the
> default) for the following four enums:
>
> - WGPUBufferBindingType
> - WGPUSamplerBindingType
> - WGPUTextureSampleType
> - WGPUStorageTextureAccess
>
> webgpu-native/webgpu-headers#364
>
> Bug: 377820810
> Change-Id: Id75bd9f05a78e8f08a319ef70050f45423f37e3d
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/215114
> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
> Reviewed-by: Kai Ninomiya <kainino@chromium.org>

Bug: 377820810
Change-Id: I095a88650a181d96fb6930d3eb606cb26c029147
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/217976
Auto-Submit: Loko Kung <lokokung@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
copybara-service bot pushed a commit to google/dawn that referenced this pull request Jan 8, 2025
This CL adds Undefined for the following binding types and change the
default value in binding layout for those:
- WGPUBufferBindingType: Undefined -> Uniform
- WGPUSamplerBindingType: Undefined -> Filtering
- WGPUTextureSampleType: Undefined -> Float
- WGPUStorageTextureAccess: Undefined -> WriteOnly

Spec PR: webgpu-native/webgpu-headers#364

Bug: 377820810
Change-Id: Ic96a6d2cc1387b6ebe9cef9a9dd1aa2e6789529c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/219915
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
kainino0x added a commit to kainino0x/webgpu-headers that referenced this pull request Apr 25, 2025
We decided that we would not name this:
webgpu-native#45 (comment)

But I missed it in webgpu-native#364.

Technically breaking, but since it didn't do anything, any references to
it are going to be trivial (e.g. `case` statements).

Issue: webgpu-native#45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants