Skip to content
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
merged 1 commit into from
Oct 15, 2024

Conversation

greggman
Copy link
Contributor

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 greggman requested review from kainino0x and shrekshao and removed request for kainino0x October 11, 2024 08:21
Copy link
Contributor

@shrekshao shrekshao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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 greggman force-pushed the identify-sample-points-for-compare branch from 0da532e to c53cadc Compare October 15, 2024 01:07
@greggman greggman merged commit 7ec238c into gpuweb:main Oct 15, 2024
1 check passed
@greggman greggman deleted the identify-sample-points-for-compare branch October 15, 2024 01:11
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants