Skip to content

Implement 'index_range' test in getBindGroupLayout.spec.ts - #1892

Merged
kainino0x merged 1 commit into
gpuweb:mainfrom
Gyuyoung:index-getBindGroupLayout
Oct 6, 2022
Merged

kainino0x merged 1 commit into
gpuweb:mainfrom
Gyuyoung:index-getBindGroupLayout

Conversation

@Gyuyoung

@Gyuyoung Gyuyoung commented Oct 4, 2022 •

Copy link
Copy Markdown
Collaborator

According to the specification, the index of getBindGroupLayout should not exceed the size of the bind group layouts. So this PR implements a new test to ensure it.

Issue: #1891


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.)

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.

@github-actions

github-actions Bot commented Oct 4, 2022

Copy link
Copy Markdown

Previews, as seen when this build job started (27c16d9):
Run tests | View tsdoc

@Gyuyoung
Gyuyoung requested a review from kainino0x October 4, 2022 12:49
@Gyuyoung
Gyuyoung marked this pull request as ready for review October 4, 2022 12:49

@kainino0x kainino0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have a few minor comments, but this also reminded me about some issues in the spec. Those will need to get resolved before we can complete this. See below for details, and sorry for the blocker!

const shouldError = index >= maxBindGroups;

t.expectValidationError(() => {
pipeline.getBindGroupLayout(index);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

According to the spec, at least as currently written, this is supposed to throw an exception if index >= maxBindGroups. It's only a validation error if it's < maxBindGroups but >= the number of bind groups actually in the layout.

HOWEVER: I actually think we should change this in the spec. It doesn't seem consistent with other parts of the API. I'm going to open a spec proposal about it. Let's see if that gets resolved quickly.

Note, there's also an issue where "auto" layouts always fill the array up to maxBindGroups, instead of only up to the highest bind group index needed. I think this is a bug in the spec, so ignore this for now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gpuweb/gpuweb#3505

gpuweb/gpuweb#3506

Hoping both can be resolved tomorrow.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for checking it. Once let me update this PR with some fixes you pointed out.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There have been no objections so far, so let's move forward assuming they'll land.

@Gyuyoung
Gyuyoung force-pushed the index-getBindGroupLayout branch from 27c16d9 to 489ac64 Compare October 5, 2022 03:20
@github-actions

github-actions Bot commented Oct 5, 2022

Copy link
Copy Markdown

Previews, as seen when this build job started (489ac64):
Run tests | View tsdoc

@kainino0x kainino0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with some small changes

According to the specification, the index of getBindGroupLayout should not
exceed the size of the bind group layouts. So this PR implements a new
test to ensure it.

Issue: gpuweb#1891
@Gyuyoung
Gyuyoung force-pushed the index-getBindGroupLayout branch from 489ac64 to c87eadb Compare October 6, 2022 01:31
@kainino0x
kainino0x merged commit 2abd75d into gpuweb:main Oct 6, 2022
@Gyuyoung
Gyuyoung deleted the index-getBindGroupLayout branch October 6, 2022 05:41
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