-
Notifications
You must be signed in to change notification settings - Fork 100
Minor change in sample mask behavior for the case of sample shading #4510
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
base: main
Are you sure you want to change the base?
Minor change in sample mask behavior for the case of sample shading #4510
Conversation
mwyrzykowski
left a comment
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 think this is incorrect. The current definition of sample_mask:
Sample coverage mask for the current fragment. It contains a bitmask indicating which samples in this fragment are covered by the primitive being rendered.
There is nothing in the definition indicating sample_mask is per-sample, one would it expect it to be constant per-fragment.
|
Isn't one fragment = the output of one invocation of the fragment shader? So may be a single sample or not, depending on which mode the fragment shader is running in. |
We discussed briefly in the WGSL meeting, there is certainly confusion regarding this. In Metal, one fragment corresponds to a single texel in the render target. I.e., there may be up to [sample-count] fragment function invocations per fragment. This also aligns with the definition here, not say that's a definitive source either.
edit: the Wikipedia definition concurs with Computer Graphics: Principles and Practice (3rd edition), page 433:
given the book's relevance over the past 40 years that seems like an accurate definition. In the case of multisampling, the fragment includes all the samples which lie inside the triangle and contained within the bounds of a pixel |
|
My reading of opengl is that there are multiple fragments per pixel.
However clearly, in the case we were discussing (sample shading) it is as you say multiple invocations per fragment
from vkdoc However we are still stuck in vulkan with
Which is why I think we get the vulkan behavior we see. (this is possibly motivated due to writing to sample mask as well) |
|
I stand corrected. From looking at Vulkan and GL, I'm getting the sense that "fragment" = one pixel-sized chunk of one primitive, prior to whatever fragment shader(s) run on it. I'm looking at Vulkan section "Sample Shading" and GL4.6/GLES3.2 sections "Shader Memory Access Ordering". |
Oops forgot to say - I agree this text from the OpenGL wiki does read the way you interpreted it, but I think that's inconsistent with the (latest) OpenGL specs. |
This is to make us aligned with existing spec and vulkan behavior.
Webgpu issue
gpuweb/gpuweb#5457