Gpuweb: Consider [[binding(n, m)]] instead of [[set n, binding m]]

Created on 11 Sep 2020  路  6Comments  路  Source: gpuweb/gpuweb

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 https://github.com/gpuweb/gpuweb/pull/1046#issuecomment-689070418_

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.

wgsl

All 6 comments

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

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

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)]]?

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.

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)]]

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krogovin picture krogovin  路  5Comments

enkicoma picture enkicoma  路  6Comments

Nielsbishere picture Nielsbishere  路  5Comments

Kangz picture Kangz  路  6Comments

kvark picture kvark  路  5Comments