-
Notifications
You must be signed in to change notification settings - Fork 82
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
Make identifySamplePoints handle compare #3996
Merged
greggman
merged 1 commit into
gpuweb:main
from
greggman:identify-sample-points-for-compare
Oct 15, 2024
Merged
Make identifySamplePoints handle compare #3996
greggman
merged 1 commit into
gpuweb:main
from
greggman:identify-sample-points-for-compare
Oct 15, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greggman
requested review from
kainino0x and
shrekshao
and removed request for
kainino0x
October 11, 2024 08:21
shrekshao
approved these changes
Oct 15, 2024
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.
LGTM
src/webgpu/shader/execution/expression/call/builtin/texture_utils.ts
Outdated
Show resolved
Hide resolved
identifySamplePoints works by doing a binary search filling a texture with black (0,0,0,0) and white (1,1,1,1) texels and then sampling it. Any non-zero results means those white pixels were sampled. This doesn't work for comparisons like textureSampleCompare, textureSampleCompareLevel, and textureGatherCompare because the result of those are 0 or 1 so for example, of the comparison is 'always' then all texels will show up as sampled. So, instead, if the builtin being tested is a comparison we convert the call to the corresponding non-comparsion builtin. * textureSampleCompare -> textureSample * textureSampleCompareLevel -> textureSampleLevel * textureGatherCompare -> textureGather This lets us find the sample points as best we can (it assumes those functions sample the same texels). Once we have the sample point we then want to look up the actual values of the texels and print them out. To do this requires reading the texture back from the GPU. We made the texture ourselves so we could maybe theoretically pass the data we sent to the GPU down to identifySamplePoints but it seems good to get the values from the GPU itself so at least they made a round trip through the GPU When, if it's a comparison, we print out the result of each comparison with that texel. Hopefully this will help us identify why these tests don't pass on some devices.
greggman
force-pushed
the
identify-sample-points-for-compare
branch
from
October 15, 2024 01:07
0da532e
to
c53cadc
Compare
teoxoy
pushed a commit
to mozilla/gpuweb-cts
that referenced
this pull request
Oct 25, 2024
identifySamplePoints works by doing a binary search filling a texture with black (0,0,0,0) and white (1,1,1,1) texels and then sampling it. Any non-zero results means those white pixels were sampled. This doesn't work for comparisons like textureSampleCompare, textureSampleCompareLevel, and textureGatherCompare because the result of those are 0 or 1 so for example, of the comparison is 'always' then all texels will show up as sampled. So, instead, if the builtin being tested is a comparison we convert the call to the corresponding non-comparsion builtin. * textureSampleCompare -> textureSample * textureSampleCompareLevel -> textureSampleLevel * textureGatherCompare -> textureGather This lets us find the sample points as best we can (it assumes those functions sample the same texels). Once we have the sample point we then want to look up the actual values of the texels and print them out. To do this requires reading the texture back from the GPU. We made the texture ourselves so we could maybe theoretically pass the data we sent to the GPU down to identifySamplePoints but it seems good to get the values from the GPU itself so at least they made a round trip through the GPU When, if it's a comparison, we print out the result of each comparison with that texel. Hopefully this will help us identify why these tests don't pass on some devices.
teoxoy
pushed a commit
to mozilla/gpuweb-cts
that referenced
this pull request
Oct 25, 2024
identifySamplePoints works by doing a binary search filling a texture with black (0,0,0,0) and white (1,1,1,1) texels and then sampling it. Any non-zero results means those white pixels were sampled. This doesn't work for comparisons like textureSampleCompare, textureSampleCompareLevel, and textureGatherCompare because the result of those are 0 or 1 so for example, of the comparison is 'always' then all texels will show up as sampled. So, instead, if the builtin being tested is a comparison we convert the call to the corresponding non-comparsion builtin. * textureSampleCompare -> textureSample * textureSampleCompareLevel -> textureSampleLevel * textureGatherCompare -> textureGather This lets us find the sample points as best we can (it assumes those functions sample the same texels). Once we have the sample point we then want to look up the actual values of the texels and print them out. To do this requires reading the texture back from the GPU. We made the texture ourselves so we could maybe theoretically pass the data we sent to the GPU down to identifySamplePoints but it seems good to get the values from the GPU itself so at least they made a round trip through the GPU When, if it's a comparison, we print out the result of each comparison with that texel. Hopefully this will help us identify why these tests don't pass on some devices.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
identifySamplePoints works by doing a binary search filling a texture with black (0,0,0,0) and white (1,1,1,1) texels and then sampling it. Any non-zero results means those white pixels were sampled.
This doesn't work for comparisons like textureSampleCompare, textureSampleCompareLevel, and textureGatherCompare because the result of those are 0 or 1 so for example, of the comparison is 'always' then all texels will show up as sampled.
So, instead, if the builtin being tested is a comparison we convert the call to the corresponding non-comparsion builtin.
This lets us find the sample points as best we can (it assumes those functions sample the same texels).
Once we have the sample point we then want to look up the actual values of the texels and print them out. To do this requires reading the texture back from the GPU. We made the texture ourselves so we could maybe theoretically pass the data we sent to the GPU down to identifySamplePoints but it seems good to get the values from the GPU itself so at least they made a round trip through the GPU
When, if it's a comparison, we print out the result of each comparison with that texel. Hopefully this will help us identify why these tests don't pass on some devices.