-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional feature clip-distances
#4588
Conversation
This patch adds the optional feature `clip-distance to WebGPU API and WGSL SPEC. - Add WebGPU API and WGSL optional feature `clip-distance` - Add new vertex stage output builtin variable `clip-distance` - Update the primitive clipping algorithm with user-defined clip distances - Add new validation rules to the validation algorithm on inter-stage interfaces when `clip-distance` is used in the vertex stage - Add new device limit `maxClipDistances` and update the related vertex stage validation algorithm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it would help developers if WGSL builtin value was renamed to clip_distances
and WebGPU feature to "clip-distances"
.
Previews, as seen when this build job started (466c36f): |
Done @beaufortfrancois |
I'm still seeing singular "clip distance", not plural "clip distances". |
Sorry @beaufortfrancois , now there should be no |
You may want to edit #4588 (comment) and PR title as well. |
clip-distance
clip-distances
Done |
wgsl/index.bs
Outdated
<tr><td>[=built-in values/clip_distances=] | ||
<td>vertex | ||
<td>output | ||
<td>array<f32, N> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell, the API requires N
to be 8. Is there a reason not to restrict WGSL to the same value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the restriction to WGSL. PTAL, thanks!
GPU Web WG 2024-05-08 Pacific-time
|
Hi @kainino0x @alan-baker could you take a look at this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specs LGTM. I haven't dug into the backend investigations but it seems like the mapping is fairly straightforward. Still, what is the status of prototyping and testing? It would be helpful to know that it's behaving consistently across backends.
Hi @kainino0x , I haven't started prototyping and testing yet but according to previous investigations the behaviors of clip distances are quite clear and should be same among D3D12, Metal and Vulkan. Do you think now we should have more experiments and prototyping on this feature? |
IMO for nontrivial changes, at least one prototype and some basic tests should work before we land changes to the spec (and then land the tests). Generally I'd like the spec to be "evergreen", by which I mean, it should always be a valid target for implementations, and we need implementation experience to be sure of that. We could reevaluate that once we've published a Candidate Recommendation, but right now I think it's necessary. |
We can discuss at the WG meeting though, maybe people think the investigation already meets the bar needed to land the spec. |
Note that in SPIRV-Cross the SPIRV |
This patch adds the optional feature
clip-distances
to WebGPU API and WGSL SPEC.clip-distances
clip_distances
clip-distances
is used in the vertex stagemaxClipDistancesSize
and update the related vertex stage validation algorithmFixed: #390