In `wgpu_bindings::Message::QueueOnSubmittedWorkDone`, include the id
of the device to which the queue belongs. Pass this value in
`mozilla::webgpu::Queue::OnSubmittedWorkDone`. Ignore it for now in
`wgpu_bindings::server::process_message`; later commits will use it to
request wgpu device polling.
Differential Revision: https://phabricator.services.mozilla.com/D285434
When importing an external texture in the content process, call
BuildSurfaceDescriptorGPUVideoOrBuffer() instead of
BuildSurfaceDescriptorBuffer(), in order to avoid a readback of GPUVideo
images into a shmem.
In the GPU process, handle GPUVideo surface descriptors. For Tnull_t, if
the remote texture host is a BufferTextureHost we can use the existing
CreateFromBufferDesc() path to create the required wgpu textures. For
TSurfaceDescriptorD3D10 and TSurfaceDescriptorDXGIYCbCr we add new paths
to import the textures directly into wgpu via their shared
handles. SurfaceDescriptorDXGIYCbCr always requires 3 textures and
views: for Y, Cb, and Cr planes respectively. SurfaceDescriptorD3D10 can
come in a variety of formats, which we attempt to handle.
If a CompositeProcessFencesHolderId is provided we must ensure we wait
on the appropriate write fence prior to reading from the texture. To
ensure this occurs, we make the ExternalTextureSourceHost hold on to its
fences holder ID. When submitting command buffers, we pass the list of
used external texture sources to the host side, then on the host side
for each source we call OnBeforeQueueSubmit(). This obtains the write
fence's shared handle and the value which must be waited for from the
CompositeProcessD3D11FencesHolderMap, then imports the fence from the
shared handle and inserts a wait for the specified value into the
command queue.
If available, we request wgpu's TEXTURE_FORMAT_NV12,
TEXTURE_FORMAT_P010, and TEXTURE_FORMAT_16BIT_NORM features. The first
is required for NV12 format textures, and the latter 2 are required for
P010. If unavailable, we will gracefully fail to create these textures
but other content will continue to work. It would be surprising,
however, if the decoder were to provide us with textures in these
formats when they are not supported.
Differential Revision: https://phabricator.services.mozilla.com/D261424
When importing an external texture in the content process, call
BuildSurfaceDescriptorGPUVideoOrBuffer() instead of
BuildSurfaceDescriptorBuffer(), in order to avoid a readback of GPUVideo
images into a shmem.
In the GPU process, handle GPUVideo surface descriptors. For Tnull_t, if
the remote texture host is a BufferTextureHost we can use the existing
CreateFromBufferDesc() path to create the required wgpu textures. For
TSurfaceDescriptorD3D10 and TSurfaceDescriptorDXGIYCbCr we add new paths
to import the textures directly into wgpu via their shared
handles. SurfaceDescriptorDXGIYCbCr always requires 3 textures and
views: for Y, Cb, and Cr planes respectively. SurfaceDescriptorD3D10 can
come in a variety of formats, which we attempt to handle.
If a CompositeProcessFencesHolderId is provided we must ensure we wait
on the appropriate write fence prior to reading from the texture. To
ensure this occurs, we make the ExternalTextureSourceHost hold on to its
fences holder ID. When submitting command buffers, we pass the list of
used external texture sources to the host side, then on the host side
for each source we call OnBeforeQueueSubmit(). This obtains the write
fence's shared handle and the value which must be waited for from the
CompositeProcessD3D11FencesHolderMap, then imports the fence from the
shared handle and inserts a wait for the specified value into the
command queue.
If available, we request wgpu's TEXTURE_FORMAT_NV12,
TEXTURE_FORMAT_P010, and TEXTURE_FORMAT_16BIT_NORM features. The first
is required for NV12 format textures, and the latter 2 are required for
P010. If unavailable, we will gracefully fail to create these textures
but other content will continue to work. It would be surprising,
however, if the decoder were to provide us with textures in these
formats when they are not supported.
Differential Revision: https://phabricator.services.mozilla.com/D261424
And then eagerly destroy external textures and external texture sources
when possible.
We must retain a reference to the layers::Image from which an external
texture source was imported as long as any work involving external
textures created from that source is outstanding. This prevents the
decoder from attempting to recycle the underlying resource too early,
e.g. decoding a future video frame into the texture while wgpu is still
to render the previous frame.
On the other hand, we don't want to hold on to resources longer than
required in order to prevent excess memory usage.
For each external texture, keep track of submission index at which work
involving the external texture was last submitted, and the index of the
last such submission whose work has since completed. When all submitted
work for an external texture has completed, and the external texture
has been expired, eagerly destroy the external texture.
Additionally, when the external texture is destroyed also release its
reference to the external texture source. This means the source will
itself be destroyed as soon as there are no more live external textures
that were created from it. When the source is destroyed the last
reference to the layes::Image will be dropped, indicating to the
decoder that it can reuse the underlying resources.
Differential Revision: https://phabricator.services.mozilla.com/D260826
For each individual queue we know that the pending work done promises
will be resolved FIFO. However, there are no guarantees about the order
in which separate queues will complete work. We must therefore keep a
separate deque of promises for each queue to ensure that we resolve
the correct one.
Differential Revision: https://phabricator.services.mozilla.com/D260816
ExternalTextures imported from HTMLVideoElements get "expired" in the
"automatic expiry task source", which is implemented by scheduling a
stable state task. ExternalTextures imported from VideoFrames get
expired when the VideoFrame is closed.
Keep track of each external texture used by any used bind group when
encoding compute and render passes. When submitting, if any passes
contain expired external textures then raise a validation error.
Currently we always create a new ExternalTexture when
importExternalTexture() is called. When support for reusing previously
imported textures is added, we must ensure they are correctly
"unexpired".
Differential Revision: https://phabricator.services.mozilla.com/D260295
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.
Differential Revision: https://phabricator.services.mozilla.com/D256800
This reverts commit 22fb6f2691.
Revert "Bug 1975714 - Update backlog expectations. r=webgpu-reviewers,nical"
This reverts commit 72b4644a09.
Revert "Bug 1975714 - Use `MOZ_CAN_RUN_SCRIPT_BOUNDARY` for `reportCompilationMessagesToConsole`. r=webgpu-reviewers,ErichDonGubler"
This reverts commit 4394625f93.
Revert "Bug 1975714 - Assert that the IDs in server messages are the same as the ones the `WebGPUChild` actor expects. r=webgpu-reviewers,nical"
This reverts commit 5ce8cf9b12.
Revert "Bug 1978369 - Stop leaking queues. r=webgpu-reviewers,nical"
This reverts commit 32ab875eab.
Revert "Bug 1975714 - Move remaining ID creation/destruction into resource creation/destruction functions. r=webgpu-reviewers,nical"
This reverts commit 122e1a6529.
Revert "Bug 1975714 - Replace uses of `make_slice` with `FfiSlice`. r=webgpu-reviewers,ErichDonGubler"
This reverts commit 62add844bf.
Revert "Bug 1975714 - Use `FfiSlice` in remaining places. r=webgpu-reviewers,ErichDonGubler"
This reverts commit 3812af72dd.
Revert "Bug 1975714 - Use an opaque pointer for `WebGPUParent`. r=webgpu-reviewers,ErichDonGubler"
This reverts commit bf83ea6553.
Revert "Bug 1975714 - Remove unneeded `#[allow(dead_code)]`. r=webgpu-reviewers,ErichDonGubler"
This reverts commit a84b40d4b8.
Revert "Bug 1977861 - Stop leaking BGLs returned by GPUPipelineBase.getBindGroupLayout(). r=webgpu-reviewers,ErichDonGubler"
This reverts commit b5ec027bf9.
Revert "Bug 1975714 - Turn function pointers into extern fns. r=webgpu-reviewers,nical"
This reverts commit d3681b7012.
Revert "Bug 1975714 - Make sure to resolve/reject all pending promises in `ClearActorState`. r=webgpu-reviewers,nical"
This reverts commit 2f607174ce.
Revert "Bug 1975714 - Do not immediately resolve the lost promise on `device.destroy()`. r=webgpu-reviewers,nical"
This reverts commit 1c10e1f698.
Revert "Bug 1960399 - Reject async pipeline creation with `GPUPipelineError`. r=webgpu-reviewers,nical"
This reverts commit ee47165e63.
Revert "Bug 1975714 - Correct comments. r=webgpu-reviewers,nical"
This reverts commit 9e0aabda0e.
As this is only used in the `source.origin` field for
`GPUQueue.copyExternalImageToTexture`, we can keep this validation in
the body of this method, for now.
Differential Revision: https://phabricator.services.mozilla.com/D255663
This adds BindingFwd.h for each webidl file and adds:
1. Interface declarations
2. Dictionary declarations
3. Union aliases
Differential Revision: https://phabricator.services.mozilla.com/D245340
Driven by [gpuweb#4838](https://github.com/gpuweb/gpuweb/pull/4838).
The vast majority of this script was implemented with a Nushell script,
using the `nu` binary and the wonderful `fastmod` tool
```
# Copy-pasted from the OP in [`gpuweb`#4838](https://github.com/gpuweb/gpuweb/pull/4838).
let renames_table = '
Type Old New Used in
dict GPUImageDataLayout GPUTexelCopyBufferLayout "writeTexture,
parent type of ↙"
dict GPUImageCopyBuffer "GPUTexelCopyBufferInfo
extends ↑" T2B, B2T
dict GPUImageCopyTexture GPUTexelCopyTextureInfo T2B, B2T, T2T, writeTexture
dict GPUImageCopyTextureTagged "GPUCopyExternalImageDestInfo
extends ↑" copyExternalImageToTexture
dict GPUImageCopyExternalImage GPUCopyExternalImageSourceInfo copyExternalImageToTexture
union GPUImageCopyExternalImageSource GPUCopyExternalImageSource member of ↖
'
let renames_table = $renames_table
| from tsv
| select 'Old ' 'New '
| rename old new
| update new { $in | lines | get 0 } # only the first line has the renamed symbol identifier
| update new { str trim }
| update old { str trim }
| sort-by old | reverse # Replace most specific symbol names first (some have the same "word segments" but with fewer segments)
# Rename image APIs.
let rename_paths = [
...("dom/webgpu/*.{cpp,h}" | str expand)
"dom/webidl/WebGPU.webidl"
] | each { glob $in } | flatten
for entry in $renames_table {
print $'replacing ($entry.old | to nuon) with ($entry.new | to nuon)'
fastmod --accept-all $'\b($entry.old)' $entry.new ...$rename_paths
}
```
Differential Revision: https://phabricator.services.mozilla.com/D230193