Repository navigation
Entry point fix, describe workgroups - #1046
Conversation
|
Preview of contents: https://gistpreview.github.io/?38fee9b1c324bd449a65a06fe476594e#entry-point-decl See "Entry point declaration" section and "Compute shaders and workgroups" |
8ac6f24 to
b240900
Compare
| <xmp> | ||
| entry_point vertex = main | ||
| OpEntryPoint Vertex %vtx_main "vtx_main" %gl_FragColor | ||
| vertex fn vtx_main() -> void { gl_Position = vec4<f32>(); } |
There was a problem hiding this comment.
did we consider making the stage selection more... regular in terms of syntax?
E.g. fn<vertex> vtx_main() -> void {... }
There was a problem hiding this comment.
We didn't discuss it much.
I didn't even know if the stage name should go before or after fn.
I like the template syntax you suggested.
There was a problem hiding this comment.
This is some rework of the grammar, so I'd like to agree on this in the group before making this change.
There was a problem hiding this comment.
Resolution in 2020-09-15 meeting is to use syntax like this:
[[stage(fragment)]] fn main()....
|
Whatever the resolution here is, I'd like to consider doing the same thing for bindings. |
|
I have a bunch of sometimes-opposing/contradictory feelings on this, but here's the signal I have dredged out of them. I think my prefs are:
|
|
Discussed in the 2020-09-08 WGSL meeting
I have refreshed the HTML in the gist. https://gistpreview.github.io/?38fee9b1c324bd449a65a06fe476594e#entry-point-decl On the "how to I write many attributes" front, early on we at Google decided that [[attr, attr2]] was better than [[attr]] [[attr2]]. It was less fussy and less typing. |
|
While we're bikeshedding (EDIT: oops, posted at the same time as the comment above): I think a lot of people don't like this, but I personally like: mainly because in practice I would probably put these on separate lines, and IMO this syntax makes that a bit cleaner than: . I would also support something like this (looks like a function) or even like in Python or Java. |
|
I recommend reading through https://en.cppreference.com/w/cpp/language/attributes and fully understanding its power before spending time trying to invent new syntax that might not work as well. Especially where both space and parenthesis have their own meaning. For HLSL, we discussed this and chose Really seems worth following precedence here in C++, GLSL, HLSL, probably many others, and saving time as well. |
|
Attribute syntax is a larger topic that we haven't addressed in a focused way. If the attribute syntax is truly the only sticking point, and it is orthogonal to content being proposed here I suggest we land this and start a separate focused issue for attribute syntax. |
|
I'm in favor of using the C++ style (or a similar style from another language) and making it work nicely for what we have already (e.g. |
|
We can continue this topic here: #1067 |
|
And an issue for the [[binding(n,m)]] issue: #1068 |
|
My vote is for the |
Fixes gpuweb#662 : Declare an entry point by decorating the function declaration - Adds ability to add attributes to an entry point declaration - Adds the workgroup_size attribute - Describes compute shader dispatch, in a new "Compute shaders and workgroups" section
Instead, assert the existince of a dispatch command of some sort, without saying how it was created.
- use space-separated literals, instead of function-style parameter list - the y and z dimensions are optional, defaulting to 1.
- Functions can now have attributes - So far the only attributes are for entry points. - Add 'stage' attribute - Remove 'entry_point' as a statement.
- Other uses of attribues should be updated in another MR. Also: - Add an example of a compute shader declared without workgroup_size attirbute. In this case it defaults to a workgroup size of (1,1,1), and we show this in the sample translation snippit to SPIR-V. - Fix grammar when explaining how invocations are organized into workgroups.
|
I've addressed all feedback now. PTAL. |
kvark
left a comment
There was a problem hiding this comment.
loots of good material in here!
|
|
||
| * The entry point function for the stage. | ||
| * The targets of function calls from within the body of a function | ||
| in the shader stage, whether or not that call is executed. |
There was a problem hiding this comment.
it would be useful to define "statically reachable" somewhere and refer to it in places like this instead of redefining
* Update canvas_complex_bgra8unorm_copy.https.html Adding fuzzyness * Update canvas_complex_bgra8unorm_draw.https.html * Update canvas_composite_alpha_bgra8unorm_opaque_copy.https.html * Update canvas_composite_alpha_bgra8unorm_opaque_draw.https.html * Update canvas_composite_alpha_bgra8unorm_premultiplied_copy.https.html * Update canvas_composite_alpha_bgra8unorm_premultiplied_draw.https.html * Update canvas_complex_bgra8unorm_copy.https.html * Update canvas_complex_bgra8unorm_draw.https.html
Fixes #662 : Declare an entry point by decorating the function declaration
workgroups" section