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

WGSL textureSample tests #3940

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

greggman
Copy link
Contributor

@greggman greggman commented Sep 9, 2024

Add all the textureSample tests. cube and cube-array tests with derivatives are currently skipped or filtered out as the software rasterizer can't handle this case correctly or at least doesn't match too many GPUs. Rather than increase the tolerances I'm hoping to find something I can measure, like the mapping between derivative and mix-weight, that will give us some way to test per GPU.

There's a big change to the soft rasterizer to compute derivatives by setting up 2x2 pixels and computing the derivatives by the differences between the directions.


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)
  • Test have be tested with compatibility mode validation enabled and behave as expected. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located in the test tree.
  • Test descriptions allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Helpers and types promote readability and maintainability.

When landing this PR, be sure to make any necessary issue status updates.

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

(I don't really do the % / math for calculating coords. If they pass local test I assume they are good -_-)

Add all the textureSample tests. cube and cube-array tests with
derivatives are currently skipped or filtered out as the software
rasterizer can't handle this case correctly or at least doesn't
match too many GPUs. Rather than increase the tolerances I'm
hoping to find something I can measure, like the mapping between
derivative and mix-weight, that will give us some way to test
per GPU.

There's a big change to the soft rasterizer to compute derivatives
by setting up 2x2 pixels and computing the derivatives by the
differences between the directions.
@greggman
Copy link
Contributor Author

Hey @shrekshao, could you please re-review this. I changed it to use your min/max suggestion.

The first pass I tried maxFractionalDiff = 0. This doesn't work with nearest filtering because only 1 sample is checked and it needs to be an exact match. I tried +/- 1 / 255 and +/- 2 / 255 and it still failed a few places so it's using the same maxFractionalDiff values as the existing tests which is 0 for sint/uint textures and otherwise, various values.

Anyway, the tests seem to pass except for legit failures (see run)

Legit failures are (1) OpenGL on Linux (compat), reading depth textures returns 0 always (2) Linux Vulkan Intel seems completely broken. Otherwise, lots of stuff that was failing is no longer failing.

Also, I added some more weight queries which was an attempt to figure out what the GPU is doing and applying those to the software renderer. That code path is used by the non-derivative tests. I didn't change the non-derviative tests to use the min/max path as they are already passing.

Anyway, with such a big change it seemed best to ask for a new review. Thanks!

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