Allow reading back from canvases after present#2905
Merged
kainino0x merged 5 commits intogpuweb:mainfrom May 26, 2022
Merged
Conversation
This allows drawImage/toDataURL/etc. to see the canvas contents presented in the previous frame, as long as getCurrentTexture (or configure/unconfigure) hasn't been called yet this frame. alphaMode (née compositingAlphaMode) now affects using the canvas as an image source (drawImage/etc.) as well as compositing, so that the observed contents don't change on a frame boundary. As a weird aside (necessary to fully define the image source behavior), defines super-luminant values as being in the extended color space (i.e. once un-premultiplied). This definition emerges naturally, but it's also weird. Fixes gpuweb#2743 Fixes gpuweb#1847 Fixes a leftover bit from gpuweb#2373 (placeholder canvases)
Contributor
Author
|
@toji @kdashg @shaoboyan PTAL, but don't worry about the fine details just yet because we still need to bring this proposal to the group. |
Contributor
Contributor
Author
|
For some examples of the behavior of this proposal, see here: |
This fixes several problems: - Unnecessary complexity in how currentTexture logic works. - Errors in the previous commit, where this was just not fully handled. - Using the "destroyed" state on the content process (minor issue).
Contributor
Author
This fixes several problems:
|
Contributor
Author
|
The proposal for readback after present is accepted, so @toji PTAL |
Contributor
Contributor
Author
|
Something wrong with CI, forcing merge |
github-actions bot
added a commit
that referenced
this pull request
May 26, 2022
SHA: b085e00 Reason: push, by @kainino0x Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions bot
added a commit
that referenced
this pull request
May 26, 2022
SHA: b085e00 Reason: push, by @kainino0x Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
May 31, 2022
Syncs up Blink with change recently made to the WebGPU spec. See: gpuweb/gpuweb#2905 Bug: 1069302 Change-Id: I091aceabaa1d2998dc39dd575bc0de92e596026f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3673936 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org> Cr-Commit-Position: refs/heads/main@{#1009248}
kainino0x
added a commit
to kainino0x/gpuweb
that referenced
this pull request
Jul 23, 2022
Without this, `getCurrentTexture()` doesn't know it's supposed to allocate a new texture, it just keeps using the destroyed one. And related language tweaks. Issue introduced in gpuweb#2905. This PR still implements the behavior described and agreed upon there. Issue found in whatwg/html#8123.
kainino0x
added a commit
that referenced
this pull request
Jul 23, 2022
* Set currentTexture to null on presentation Without this, `getCurrentTexture()` doesn't know it's supposed to allocate a new texture, it just keeps using the destroyed one. And related language tweaks. Issue introduced in #2905. This PR still implements the behavior described and agreed upon there. Issue found in whatwg/html#8123. * nit
jdarpinian
pushed a commit
to jdarpinian/gpuweb
that referenced
this pull request
Aug 12, 2022
* Allow reading back from canvases after present This allows drawImage/toDataURL/etc. to see the canvas contents presented in the previous frame, as long as getCurrentTexture (or configure/unconfigure) hasn't been called yet this frame. alphaMode (née compositingAlphaMode) now affects using the canvas as an image source (drawImage/etc.) as well as compositing, so that the observed contents don't change on a frame boundary. As a weird aside (necessary to fully define the image source behavior), defines super-luminant values as being in the extended color space (i.e. once un-premultiplied). This definition emerges naturally, but it's also weird. Fixes gpuweb#2743 Fixes gpuweb#1847 Fixes a leftover bit from gpuweb#2373 (placeholder canvases) * nit * Remove the "cancel present" behavior of destroy() This fixes several problems: - Unnecessary complexity in how currentTexture logic works. - Errors in the previous commit, where this was just not fully handled. - Using the "destroyed" state on the content process (minor issue). * nits * nit
jdarpinian
pushed a commit
to jdarpinian/gpuweb
that referenced
this pull request
Aug 12, 2022
* Set currentTexture to null on presentation Without this, `getCurrentTexture()` doesn't know it's supposed to allocate a new texture, it just keeps using the destroyed one. And related language tweaks. Issue introduced in gpuweb#2905. This PR still implements the behavior described and agreed upon there. Issue found in whatwg/html#8123. * nit
juj
added a commit
to juj/wasm_webgpu
that referenced
this pull request
Aug 17, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal.
This allows drawImage/toDataURL/etc. to see the canvas contents
presented in the previous frame, as long as getCurrentTexture (or
configure/unconfigure) hasn't been called yet this frame.
alphaMode (née compositingAlphaMode) now affects using the canvas as an
image source (drawImage/etc.) as well as compositing, so that the
observed contents don't change on a frame boundary.
REVISION: destroy()ing a canvas texture now does not cancel presentation.
Instead, it just terminates writable-access to the drawing buffer early.
You can't get a new texture in the same frame without reallocating the
drawing buffer (configure or resize).
As a weird aside (necessary to fully define the image source behavior),
defines super-luminant values as being in the extended color space (i.e.
once un-premultiplied). This definition emerges naturally, but it's also
weird.
Fixes #2743
Fixes #1847
Fixes a leftover bit from #2373 (placeholder canvases)never mind that was for copyExternalImageToTexturePreview | Diff