Skip to content

Move all canvas configure validation to getCurrentTexture - #2536

Closed
kainino0x wants to merge 2 commits into
gpuweb:mainfrom
kainino0x:configure-late-error
Closed

kainino0x wants to merge 2 commits into
gpuweb:mainfrom
kainino0x:configure-late-error

Conversation

@kainino0x

@kainino0x kainino0x commented Jan 26, 2022 •

Copy link
Copy Markdown
Contributor

Previously, there was some validation inside configure(), but it only
covered a subset of the rules that were later covered by createTexture
inside getCurrentTexture(). This moves all of the validation to
getCurrentTexture() so it's not effectively duplicated.

Resolves an issue where configure() attempted to do device-timeline
validation but actually needed to do it on on the content timeline.

Extracted from #2416.


Preview | Diff

Previously, there was *some* validation inside configure(), but it only
covered a subset of the rules that were later covered by createTexture
inside getCurrentTexture(). This moves all of the validation to
getCurrentTexture() so it's not effectively duplicated.

Resolves an issue where configure() attempted to do device-timeline
validation but actually needed to do it on on the content timeline.

Extracted from gpuweb#2416.
@github-actions

Copy link
Copy Markdown
Contributor

Previews, as seen when this build job started (d972d0d):
WebGPU | IDL
WGSL
Explainer

@toji toji left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like it's clearly the right thing to do regardless of whether we make the change to using canvas.width/height or not. LGTM!

@github-actions

Copy link
Copy Markdown
Contributor

Previews, as seen when this build job started (70fe5ee):
WebGPU | IDL
WGSL
Explainer

@kainino0x
kainino0x requested a review from kvark January 27, 2022 01:02
@kainino0x
kainino0x marked this pull request as ready for review January 27, 2022 01:02

@kvark kvark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I asked Anne about this issue with validation briefly, and their answer was that we can say that a canvas is invalidated whenever size changes. That means, user would have to run getContext() again. And that means we can do all the validation there. So let's try to keep it validated early?

@kainino0x

Copy link
Copy Markdown
Contributor Author

Want to close this in favor of early validation, but need to extract a few other things from here so they're not lost.

@kainino0x

Copy link
Copy Markdown
Contributor Author

Done in #2819

@kainino0x kainino0x closed this May 3, 2022
@kainino0x
kainino0x deleted the configure-late-error branch May 4, 2022 00:09
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.

3 participants