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 some tests for GPUCanvasContext getConfiguration #3973

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

beaufortfrancois
Copy link
Collaborator

@beaufortfrancois beaufortfrancois commented Sep 30, 2024

This PR adds tests for the GPUCanvasContext getConfiguration() method that can be tested in Chromium patched with https://chromium-review.googlesource.com/c/chromium/src/+/5890176. It currently requires to run chromium with the experimental WebGPUExperimentalFeatures blink runtime feature (--enable-blink-features=WebGPUExperimentalFeatures). This is implied if you enable the "Unsafe WebGPU support" flag at chrome://flag#enable-unsafe-webgpu.

Spec PR: gpuweb/gpuweb#4899

image

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
Collaborator

@kainino0x kainino0x left a comment

Choose a reason for hiding this comment

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

LGTM!

package.json Show resolved Hide resolved
@beaufortfrancois
Copy link
Collaborator Author

@kainino0x I've fixed all ts errors. We should be good now.

src/webgpu/web_platform/canvas/configure.spec.ts Outdated Show resolved Hide resolved
@@ -459,8 +462,9 @@ g.test('viewFormats')
}, !compatible);

const configuration = ctx.getConfiguration();
t.expect(configuration.viewFormats?.length === 1);
t.expect(configuration.viewFormats[0] === viewFormat);
const viewFormats = Array.from(configuration!.viewFormats!);
Copy link
Collaborator

Choose a reason for hiding this comment

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

non-blocking aside: Hm, we should actually change this in the types. The GPUCanvasConfiguration object that comes from getConfiguration() is guaranteed to have an array here (not any other kind of iterable). I'll make a PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Once gpuweb/types#157 gets merged, I'll go fix the CTS. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kainino0x Here's #3977

src/webgpu/web_platform/canvas/configure.spec.ts Outdated Show resolved Hide resolved
@kainino0x kainino0x enabled auto-merge (squash) October 1, 2024 21:35
@kainino0x kainino0x merged commit c42a89c into main Oct 1, 2024
1 check passed
@kainino0x kainino0x deleted the getConfiguration branch October 1, 2024 21:37
teoxoy pushed a commit to mozilla/gpuweb-cts that referenced this pull request Oct 25, 2024
teoxoy pushed a commit to mozilla/gpuweb-cts that referenced this pull request Oct 25, 2024
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