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

Add more cases to canvas reftest with device loss #3715

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kainino0x
Copy link
Collaborator

@kainino0x kainino0x commented Apr 25, 2024

Test for gpuweb/gpuweb#4606
Expected results need careful review.
See discussion here about what the spec says: #3669 (review)

Issue: #3251


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.

@kainino0x
Copy link
Collaborator Author

cc @perryuwang

@perryuwang
Copy link
Contributor

So my understanding is as follows, is it accurate?
When canvas is configured but getCurrentTexture is not called:

  • Display a transparent image if configure()d as transparent.
  • Display a black image if configure()d as opaque.

@kainino0x
Copy link
Collaborator Author

I think so. It should be the same regardless of whether getCurrentTexture is called: both configure() and getCurrentTexture() wipe the canvas to blank (transparent or opaque depending on the configuration).

@kainino0x
Copy link
Collaborator Author

gpuweb/gpuweb#4606 was resolved, and this test should still be correct.

@kainino0x kainino0x requested a review from toji May 20, 2024 23:45
Copy link
Member

@toji toji left a comment

Choose a reason for hiding this comment

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

A couple of nits but LGTM.

let threw;
try {
const colorAttachment = ctx.getCurrentTexture();
threw = false;
Copy link
Member

Choose a reason for hiding this comment

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

Why not initialize threw to false instead of setting it here?

draw('cvs30', '#000000');
draw('cvs31', '#000000');
draw('cvs32', '#00000000');
draw('cvs33', '#00000000');
Copy link
Member

Choose a reason for hiding this comment

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

µNit: It's a little strange to have some of these colors be 6 hex digits and others be 8? I feel like the intent might be a bit clearer if we explicitly put the last FF/00 on them to indicate the expected alpha state?

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.

None yet

3 participants