WebGPU: Match WGSL syntax for texture component swizzle [chromium/src : main]

0 views
Skip to first unread message

Fr (Gerrit)

unread,
Sep 17, 2025, 5:21:38 AMSep 17
to Kentaro Hara, chromium...@chromium.org, Raphael Kubo da Costa, blink-revie...@chromium.org, jmedle...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, kainin...@chromium.org

Fr has uploaded the change for review

Commit message

WebGPU: Match WGSL syntax for texture component swizzle
Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19

Change diff


Change information

Files:
  • M third_party/blink/renderer/bindings/generated_in_modules.gni
  • M third_party/blink/renderer/modules/webgpu/dawn_enum_conversions.cc
  • M third_party/blink/renderer/modules/webgpu/dawn_enum_conversions.h
  • M third_party/blink/renderer/modules/webgpu/gpu_texture.cc
  • M third_party/blink/renderer/modules/webgpu/gpu_texture_view_descriptor.idl
  • M third_party/dawn
Change size: M
Delta: 6 files changed, 51 insertions(+), 45 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
Gerrit-Change-Number: 6958569
Gerrit-PatchSet: 1
Gerrit-Owner: Fr <beaufort...@gmail.com>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fr (Gerrit)

unread,
Sep 17, 2025, 5:53:05 AMSep 17
to Kai Ninomiya, Gregg Tavares, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org
Attention needed from Kai Ninomiya

Fr added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Fr . resolved

PTAL % spec PR reviews

Open in Gerrit

Related details

Attention is currently required from:
  • Kai Ninomiya
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
Gerrit-Change-Number: 6958569
Gerrit-PatchSet: 4
Gerrit-Owner: Fr <beaufort...@gmail.com>
Gerrit-Reviewer: Fr <beaufort...@gmail.com>
Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
Gerrit-CC: Gregg Tavares <gm...@chromium.org>
Gerrit-CC: Kentaro Hara <har...@chromium.org>
Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
Gerrit-Attention: Kai Ninomiya <kai...@chromium.org>
Gerrit-Comment-Date: Wed, 17 Sep 2025 09:52:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Kai Ninomiya (Gerrit)

unread,
Sep 19, 2025, 7:20:22 PMSep 19
to Fr, Gregg Tavares, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org
Attention needed from Fr

Kai Ninomiya added 3 comments

File third_party/blink/renderer/modules/webgpu/dawn_enum_conversions.cc
Line 991, Patchset 8 (Latest):wgpu::ComponentSwizzle AsDawnEnum(const UChar& c) {
Kai Ninomiya . unresolved

nit: UChar is a (small) pure value, so it should be passed by-value instead of by-reference

File third_party/blink/renderer/modules/webgpu/gpu_texture.cc
Line 103, Patchset 8 (Latest): const auto& swizzle = webgpu_desc->swizzle();
Kai Ninomiya . unresolved

What does this return if WebGPUExperimentalFeatures is disabled but the user passes a swizzle? I think the bindings ignore the user's request and just pass us `"rgba"`? In which case below could be just:

```
if (swizzle != "rgba") {
```

(If I'm wrong, then I think https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout.cc;l=33;drc=e7bd1b16aeb1d52e013ab5d04b4e607fdc2978b4 is also wrong)

Line 135, Patchset 8 (Latest): if (kAllowedSwizzleChars.find(static_cast<char>(swizzle[i])) ==
Kai Ninomiya . unresolved

This is a lossy cast and I believe it will allow not only `'r' = 0x72` but also `'ɲ' = 0x0272`, etc.

How about changing `AsDawnEnum`'s `default` and use:
`if (AsDawnEnum(swizzle[i]) == wgpu::ComponentSwizzle::Undefined))`
That way we only have to worry about one place understanding the strings correctly.

This is probably worth having CTS coverage for.

Open in Gerrit

Related details

Attention is currently required from:
  • Fr
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Gerrit-Change-Number: 6958569
    Gerrit-PatchSet: 8
    Gerrit-Owner: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Gregg Tavares <gm...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Fr <beaufort...@gmail.com>
    Gerrit-Comment-Date: Fri, 19 Sep 2025 23:20:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fr (Gerrit)

    unread,
    Sep 22, 2025, 3:24:33 AM (14 days ago) Sep 22
    to Kai Ninomiya, Gregg Tavares, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org
    Attention needed from Kai Ninomiya

    Fr added 3 comments

    File third_party/blink/renderer/modules/webgpu/dawn_enum_conversions.cc
    Line 991, Patchset 8:wgpu::ComponentSwizzle AsDawnEnum(const UChar& c) {
    Kai Ninomiya . resolved

    nit: UChar is a (small) pure value, so it should be passed by-value instead of by-reference

    Fr

    Done

    File third_party/blink/renderer/modules/webgpu/gpu_texture.cc
    Line 103, Patchset 8: const auto& swizzle = webgpu_desc->swizzle();
    Kai Ninomiya . resolved

    What does this return if WebGPUExperimentalFeatures is disabled but the user passes a swizzle? I think the bindings ignore the user's request and just pass us `"rgba"`? In which case below could be just:

    ```
    if (swizzle != "rgba") {
    ```

    (If I'm wrong, then I think https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout.cc;l=33;drc=e7bd1b16aeb1d52e013ab5d04b4e607fdc2978b4 is also wrong)

    Fr

    You're right! Let's simplify this code.

    Line 135, Patchset 8: if (kAllowedSwizzleChars.find(static_cast<char>(swizzle[i])) ==
    Kai Ninomiya . resolved

    This is a lossy cast and I believe it will allow not only `'r' = 0x72` but also `'ɲ' = 0x0272`, etc.

    How about changing `AsDawnEnum`'s `default` and use:
    `if (AsDawnEnum(swizzle[i]) == wgpu::ComponentSwizzle::Undefined))`
    That way we only have to worry about one place understanding the strings correctly.

    This is probably worth having CTS coverage for.

    Fr

    Good catch for the lossy cast! I've used your suggestion and will update the CTS with your suggestion: https://github.com/gpuweb/cts/pull/4427#discussion_r2366955799

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Kai Ninomiya
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Gerrit-Change-Number: 6958569
    Gerrit-PatchSet: 9
    Gerrit-Owner: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Gregg Tavares <gm...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Kai Ninomiya <kai...@chromium.org>
    Gerrit-Comment-Date: Mon, 22 Sep 2025 07:24:16 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kai Ninomiya <kai...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Kai Ninomiya (Gerrit)

    unread,
    Sep 23, 2025, 1:28:07 AM (13 days ago) Sep 23
    to Fr, Gregg Tavares, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org
    Attention needed from Fr

    Kai Ninomiya voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fr
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Gerrit-Change-Number: 6958569
    Gerrit-PatchSet: 10
    Gerrit-Owner: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Gregg Tavares <gm...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Fr <beaufort...@gmail.com>
    Gerrit-Comment-Date: Tue, 23 Sep 2025 05:27:57 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Fr (Gerrit)

    unread,
    Sep 23, 2025, 1:29:07 AM (13 days ago) Sep 23
    to Kai Ninomiya, Gregg Tavares, Chromium LUCI CQ, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org

    Fr voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Gerrit-Change-Number: 6958569
    Gerrit-PatchSet: 10
    Gerrit-Owner: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Gregg Tavares <gm...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Sep 23, 2025, 1:42:27 AM (13 days ago) Sep 23
    to Fr, Kai Ninomiya, Gregg Tavares, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org

    Chromium LUCI CQ submitted the change

    Change information

    Commit message:
    WebGPU: Match WGSL syntax for texture component swizzle

    Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Bug: 414312052
    Reviewed-by: Kai Ninomiya <kai...@chromium.org>
    Commit-Queue: Fr <beaufort...@gmail.com>
    Cr-Commit-Position: refs/heads/main@{#1519112}
    Files:
    • M third_party/blink/renderer/bindings/generated_in_modules.gni
    • M third_party/blink/renderer/modules/webgpu/dawn_enum_conversions.cc
    • M third_party/blink/renderer/modules/webgpu/dawn_enum_conversions.h
    • M third_party/blink/renderer/modules/webgpu/gpu_texture.cc
    • M third_party/blink/renderer/modules/webgpu/gpu_texture_view_descriptor.idl
    Change size: M
    Delta: 5 files changed, 53 insertions(+), 45 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Kai Ninomiya
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Gerrit-Change-Number: 6958569
    Gerrit-PatchSet: 11
    Gerrit-Owner: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    open
    diffy
    satisfied_requirement

    Fr (Gerrit)

    unread,
    Sep 25, 2025, 9:21:31 AM (11 days ago) Sep 25
    to Chromium LUCI CQ, Kai Ninomiya, Gregg Tavares, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org

    Fr has created a revert of this change

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: revert
    satisfied_requirement
    open
    diffy

    Corentin Wallez (Gerrit)

    unread,
    Sep 25, 2025, 9:30:06 AM (11 days ago) Sep 25
    to Fr, Chromium LUCI CQ, Kai Ninomiya, Gregg Tavares, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org
    Attention needed from Fr

    Corentin Wallez added 1 comment

    File third_party/blink/renderer/modules/webgpu/gpu_texture.cc
    Line 120, Patchset 11 (Latest): return false;
    Corentin Wallez . unresolved

    This should have been true to keep returning textures when the feature is not enabled.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fr
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Gerrit-Change-Number: 6958569
    Gerrit-PatchSet: 11
    Gerrit-Owner: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Corentin Wallez <cwa...@chromium.org>
    Gerrit-CC: Gregg Tavares <gm...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Attention: Fr <beaufort...@gmail.com>
    Gerrit-Comment-Date: Thu, 25 Sep 2025 13:30:00 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    open
    diffy

    Fr (Gerrit)

    unread,
    Sep 25, 2025, 11:56:15 AM (11 days ago) Sep 25
    to Chromium LUCI CQ, Corentin Wallez, Kai Ninomiya, Gregg Tavares, chromium...@chromium.org, Kentaro Hara, Raphael Kubo da Costa, blink-revie...@chromium.org, blink-...@chromium.org, cwalle...@chromium.org, jmedle...@chromium.org, kainin...@chromium.org

    Fr added 1 comment

    File third_party/blink/renderer/modules/webgpu/gpu_texture.cc
    Corentin Wallez . resolved

    This should have been true to keep returning textures when the feature is not enabled.

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ie398159c52e76839c2cd91bbf3ecf04a77568e19
    Gerrit-Change-Number: 6958569
    Gerrit-PatchSet: 11
    Gerrit-Owner: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Fr <beaufort...@gmail.com>
    Gerrit-Reviewer: Kai Ninomiya <kai...@chromium.org>
    Gerrit-CC: Corentin Wallez <cwa...@chromium.org>
    Gerrit-CC: Gregg Tavares <gm...@chromium.org>
    Gerrit-CC: Kentaro Hara <har...@chromium.org>
    Gerrit-CC: Raphael Kubo da Costa <ku...@igalia.com>
    Gerrit-Comment-Date: Thu, 25 Sep 2025 15:55:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Corentin Wallez <cwa...@chromium.org>
    satisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages