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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas context type for WebGPU #6804

Merged
merged 4 commits into from
Jul 14, 2021
Merged

Canvas context type for WebGPU #6804

merged 4 commits into from
Jul 14, 2021

Conversation

toji
Copy link
Contributor

@toji toji commented Jun 24, 2021

(See WHATWG Working Mode: Changes for more details.)


Posting this as a PR so that the proposed changes can be reviewed, but before landing the WebGPU working group would like to discuss the proposed context type string, "gpupresent", with this group. The name differs somewhat from other context types and we want to ensure that it fits the desired patterns for these strings (if there is any) and that the name is appropriately suggestive of it's function. See gpuweb/gpuweb#131 for prior discussion within the WebGPU working group on the topic.

As a brief overview: As opposed to the WebGL contexts, the "gpupresent" context type (which would return a GPUPresentationContext object) is not the primary interface for interacting with the GPU hardware in WebGPU API. That's the responsibility of the GPUDevice which is created from a GPUAdapter enumerated by the navigator interface. This is to accommodate non-visual uses of the API (making use of GPU hardware for compute capabilites, for example) and also to allow a single device to draw to multiple canvas elements.

As a result, the "gpupresent" canvas context primarily provides an surface for GPUDevice to draw to. Because of this the WebGPU working group generally wants to avoid names like "webgpu", "gpu", or anything that could be mistaken as returning the primary WebGPU interface used for rendering. "bitmaprenderer" has a somewhat similar function to the "gpupresent" context, in that it only displays images provided to it rather than producing the images itself. It's possible that a context named "gpurenderer" could imply that the context was used to produce (render) the image, however, so the term "present" is preferred here as being less ambiguous.

A final point of discussion within the WebGPU group is whether or not the context names should be considered analogous enums, and thus prefer using hyphenation? (ie: "gpu-present") It seems that "bitmaprenderer" has already established a precedent for not hyphenating, which is why "gpupresent" was chosen, but we are happy to help establish a new precedent going forward if this group would prefer.


馃挜 Error: Wattsi server error 馃挜

PR Preview failed to build. (Last tried on Jul 14, 2021, 7:04 PM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

馃毃 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.

馃敆 Related URL

<html>
<head><title>524 Origin Time-out</title></head>
<body bgcolor="white">
<center><h1>524 Origin Time-out</h1></center>
<hr><center>cloudflare-nginx</center>
</body>
</html>

If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.

@kainino0x
Copy link

@Juanmihd FYI

@annevk annevk added addition/proposal New features or enhancements topic: canvas labels Jun 25, 2021
@annevk
Copy link
Member

annevk commented Jun 25, 2021

@toji did you intentionally mark this as WIP? You'll need to make your membership of the googlers GitHub organization public for the Participation check.

@toji
Copy link
Contributor Author

toji commented Jun 25, 2021

I did mark it as WIP intentionally to underscore the fact that we want to discuss the "gpupresent" string prior to landing.

My organization memberships are public, but I don't seem to be in the Googlers org for some reason? I thought I was. I'll look into that. [UPDATE: Org joined. 馃槃] [UPDATE to UPDATE: ...and made public.]

@domenic
Copy link
Member

domenic commented Jun 25, 2021

I see you've joined the org, but your membership is still not public (you can check by viewing in private browsing mode) :).

I'll join the discussion in gpuweb/gpuweb#131 for the naming question.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

Spec text LGTM with nits

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@toji
Copy link
Contributor Author

toji commented Jun 25, 2021

Thanks for the feedback! Updated the PR with the fixes.

@toji toji marked this pull request as ready for review July 14, 2021 16:42
@toji
Copy link
Contributor Author

toji commented Jul 14, 2021

Thank you all for the feedback we received on gpuweb/gpuweb#131! As a result we've updated the context type and interface names used to take into account some of the concerns that were raised. Due to potential confusion around the term "present" or "presentation" we've dropped that verb and now define 'webgpu' as the context type (rather than 'gpupresent') and the interface it return will be a GPUCanvasContext (rather than a GPUPresentationContext), both of which should be more closely inline with existing context variants.

The functionality exposed by this interface has not changed, and it still functions as a way of returning drawing surfaces to the developer rather than the API which performs the drawing.

This pull request has been updated to reflect those changes, and as a result has been taken out of Draft mode. Please take a look and let us know if any further updates are required!

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

LGTM; thanks for the great PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements topic: canvas
Development

Successfully merging this pull request may close these issues.

None yet

4 participants