Add GPUSwapChainAlphaMode = opaque/premultiplied#1474
Conversation
|
These aren't necessarily as efficiently implementable everywhere as we would like today, but I think this might be the API we would want to offer eventually. It can be efficiently supported on some platforms, at least. I think @kvark was taking a census on this? |
|
Worth noting is that Windows has an API for this: Apple does not, and expects premultiplied rgba. You can specify |
| </thead> | ||
| <tr> | ||
| <td>{{GPUSwapChainAlphaMode/opaque}} | ||
| <td>Paint RGB as opaque and ignore alpha values. |
There was a problem hiding this comment.
We need to figure out how to describe or implement it consistently. If on one platform we have to clear alpha to 1 at the end of the pass, and on others we don't then an application that reads back the swapchain will see the difference.
There was a problem hiding this comment.
We (kvark/jdashg/I) discussed this and agreed that it wouldn't be possible to do this on a pass. It has to occur after user code loses access to the texture (after the end of the frame), so it would have to be a separate pass.
|
There are some concerns that nonPremultiplied is not worth implementing just yet, at least not with the same priority as premultiplied and opaque. |
Add note that `opaque` may incur some overhead.
There was a problem hiding this comment.
This API surface LGTM [for the current proposal], but I left a comment on #1425 (comment)
spec/index.bs
Outdated
| required GPUDevice device; | ||
| required GPUTextureFormat format; | ||
| GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT | ||
| GPUSwapChainAlphaMode alphaMode = "opaque"; |
There was a problem hiding this comment.
nit: should we call this a "composition mode" or something since it doesn't affect alpha as seen on the WebGPU side?
There was a problem hiding this comment.
@jdashg please rename this to GPUCompositeAlphaMode before landing
There was a problem hiding this comment.
And rename the dictionary member to compositeAlphaMode (or something along those lines) as well.
There was a problem hiding this comment.
Updated to GPUCanvasCompositingAlphaMode and compositingAlphaMode. Decided not to use "composite" because in this position it looks like we're using it as an adjective.
|
Are any changes needed before we land this? |
The description needs to be revised during commit, but aside from that the PR looks fine to me. |
…gpuweb#1474) * Change importExternalTexture,destroy to importExternalTexutre,expired The lifecycle of GPUExternalTexture changes from single js microtask to align with video frame from imported HTMLVideoElement. GPUExternalTexture.expired should changes from false to true when latest video frame from HTMLVideoElement is updated. fixed:gpuweb#1473 * Address comments
Closes #1425.
Preview | Diff