Skip to content

Consider [[binding(n, m)]] instead of [[set n, binding m]] #1068

Closed

Description

@kainino0x

Whatever the resolution here is, I'd like to consider doing the same thing for bindings. [[binding 0, set 1]] -> [[binding (1, 0)]]

Originally posted by @kainino0x in #1046 (comment)

Note the following precedent from HLSL for Vulkan:

For HLSL, we discussed this and chose [[vk::binding(3, 2)]], where the arguments are required binding followed by optional set.
-johnkslang

Personally I don't think the set should be optional, and I think it should come first.

Activity

  1. added
    wgsl
    on Sep 11, 2020
  2. toji commented on Sep 11, 2020

    @toji
    Member

    Would that also imply a change from [[location 0]] -> [[location(0)]] for consistency?

  3. kainino0x commented on Sep 11, 2020

    @kainino0x
    ContributorAuthor

    Maybe, but that's #1067 (I accidentally changed the syntax in this issue title)

  4. Kangz commented on Sep 14, 2020

    @Kangz
    Contributor

    How do we make it clear which one of N and M are for the group / the binding? Maybe it's better to be explicit and have [[group(M), binding(N)]]?

  5. dj2 commented on Sep 14, 2020

    @dj2
    Member

    I'm not a fan of combining the two numbers, I find it's very unfriendly to new users. (And to me as I always forget what order things go in). The [[binding 1, set 0]] syntax is much clearer as it's more explicit.

  6. dj2 commented on Sep 14, 2020

    @dj2
    Member

    Reading the shader stage CL, I've switched to preferring [[binding(1), set(0)]] as it reads a lot nicer for things like [[stage(compute), workgroup_size(1, 2, 3)]]

  7. kainino0x commented on Sep 15, 2020

    @kainino0x
    ContributorAuthor

    Resolution: Couldn't come up with a clear, satisfactory name for [[group_and_binding(n, m)]] that makes the ordering apparent. Just use [[group(n), binding(m)]]. Always require both.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgsl

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions