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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define importing VideoFrame into WebGPU #412

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions index.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@

spec: visibility-state; urlPrefix: https://www.w3.org/TR/page-visibility/#
type: enum-value; text: hidden; url: dom-visibilitystate-hidden

spec: webgpu; urlPrefix: https://www.w3.org/TR/webgpu/#
type: interface; text: GPUExternalTexture; url: gpuexternaltexture
type: dictionary; text: GPUExternalTextureDescriptor; url: dictdef-gpuexternaltexturedescriptor
for: GPUExternalTextureDescriptor;
type: dict-member; text: source; url: dom-gpuexternaltexturedescriptor-source
for: GPUDevice;
type: method; text: importExternalTexture(); url: dom-gpudevice-importexternaltexture
</pre>

<pre class='biblio'>
Expand Down Expand Up @@ -3772,6 +3780,28 @@
{{ImageBitmapOptions}} {{ImageBitmapOptions/colorSpaceConversion}}. Setting this
value to "none" disables color space conversion.

### WebGPU ### {#videoframe-webgpu}

WebCodecs extends [[WebGPU]] to allow importing {{VideoFrame}} objects via
{{GPUDevice/importExternalTexture()}}, producing opaque {{GPUExternalTexture}}
objects, which can be read from WebGPU shaders.
The definition of the {{GPUExternalTextureDescriptor/source}} member of
{{GPUExternalTextureDescriptor}} is modified to allow {{VideoFrame}}:

<xmp class='idl'>
partial dictionary GPUExternalTextureDescriptor {
required (HTMLVideoElement or VideoFrame) source;
};
</xmp>

The lifetime of such a {{GPUExternalTexture}} object is implicitly tied to the
lifetime of the source {{VideoFrame}} object.
sandersdan marked this conversation as resolved.
Show resolved Hide resolved
When the {{VideoFrame}} is [=Close VideoFrame|closed=]
(e.g. via {{VideoFrame/close()}} or
[[#videoframe-transfer-serialization|transferring the VideoFrame]]),
the {{GPUExternalTexture}} is *destroyed*, so no further operations
using it can be issued.

VideoFrame CopyTo() Options {#videoframe-copyto-options}
------------------------------------------------------------
Options to specify a rectangle of pixels to copy and the offset and stride of
Expand Down