Set initial frontFace value to "ccw" - #313
Conversation
|
The native APIs disagree what the default is, so the group decided to not default here, see #241 (comment) |
|
If all native APIs provide a default value for There are cases where web developers don't care about the |
If there was the same value defaulted by the API, then I'd happily agree with you. If it's different, there is no huge need for us to pick one.
We shouldn't optimize the API ergonomics for the minority of cases. A scenario "I don't care, so I pick any" to me is much more affordable (from the API design perspective) than "I do care, but now I have a bug because I missed it", which affects not just the writing code experience, but also examples, reviews, etc.
Ergonomics of this API isn't high on the list. Portability, security, performance - these are top priorities. Digging the pit of success for the user - this is high for me: making sure the code is clear to read and that the change to accidentally making an error is low. This applies to the |
The value of the default doesn't matter but I think having a default is important: it doesn't matter for experienced developers that know
While ergonomics is lower on the list, I believe that having defaults for harmless values like |
I don't see how this is an unnecessary noise. Back face culling is ubiquitous. And since we are not the source of vertex/mesh data for the user, it's their responsibility to communicate to us what convention that data uses. I would argue that a case where
This is true, it doesn't harm any of the hard requirements we have on the API. What it affects is how we play with the ecosystem: do we state an opinion that we try to push downstream, or do we stay unopinionated? It doesn't appear to me that stating the opinion brings us any closer to these goals either. |
|
We can always add a default later, but never take one away. As a developer, I've been tripped up by the differing frontface defaults before during ports between D3D/GL, and it's still common to see people reverse cull mode instead of setting the proper front face, so at least adding that slight moment of pause might be helpful. |
@beaufortfrancois is currently learning WebGPU, and this noise is making it more difficult to understand the API, even if I'm right there to explain things. Also he is looking at how to make articles to teach WebGPU 101 to evangelize the API and this kind of noise will scare people away. |
|
@Kangz I fail to understand how you call |
|
Imagine you come from a Javascript background and maybe have used three.js but not WebGL itself. If we want to teach you WebGPU from the basics and start with a 30-line render pipeline descriptor that introduces 10 different concepts including |
|
One thing that is certainly awkward is that frontFace is a strange pick for "the only required field". An alternate solution to this might be to make a few more fields required as well, so instead of API ergonomics is a strange thing to quantify, but I feel if we're going to have a few fields be required, they should be the ones that count. It doesn't really harm professionals either, since they're going to be passing everything anyway, and being explicit can be friendly to beginners. |
|
Some of us were thinking of perhaps letting frontFace be optional in webidl, but have unset-frontFace with triangle prims be a validation error. |
|
Just for a little extra context, IIRC we previously discussed merging frontFace with cullMode. (It may seem like frontFace doesn't matter if culling is disabled.) But there was at least one reason we couldn't do that: Still, maybe there is value in a specced default that's only allowed with cullMode |
|
I.e. |
|
|
|
Do we expect non-triangle-based topologies often? If this is raised because it's awkward for beginners to use, I don't expect point/line topologies to be part of that use case. |
|
Agreed, although, in addition to a "learning" cost, there's also an "annoyance" cost. And I think in cases where there's no downside to reducing the annoyance cost, we should. |
|
Discussed at 25 Jun 2019 teleconference |
|
Resolution: merge without changes. |
Instead of having web developers to specify a rasterizationState frontFace value for every singleGPURenderPipelineDescriptor, a default value is now provided according to spec change. See gpuweb/gpuweb#313 Bug: 877147 Change-Id: I05b059b9e189c996d8a087b45f4a3e82cffc7df0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1675764 Auto-Submit: François Beaufort <beaufort.francois@gmail.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Cr-Commit-Position: refs/heads/master@{#672010}
This changes the generated code to use class properties instead of polyfilling them. This cleans up the generated code for a lot of files. According to MDN, these are supported starting from Chrome 72, Firefox 69, and Safari 14.
Instead of having web developers to specify a rasterizationState
frontFacevalue for every singleGPURenderPipelineDescriptorand, how about having a default value as in OpenGL?GPUComputePipelineDescriptorSee https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glFrontFace.xhtml