Commit Graph

195 Commits

Author SHA1 Message Date
Kelsey Gilbert
c1af6e3f5b Bug 1837557 - Productionize webgpu pushErrorScope/popErrorScope. r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D180456
2023-06-14 05:51:00 +00:00
Jim Blandy
ded784569b Bug 1837711: Let WebGPU descriptor labels default to the empty string. r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D180511
2023-06-12 21:24:38 +00:00
Jim Blandy
04ac3bf5df Bug 1837708: Handle wgpu_bindings::client::ComputePipelineDescriptor the same way as RenderPipelineDescriptor. r=nical
Differential Revision: https://phabricator.services.mozilla.com/D180508
2023-06-12 21:24:38 +00:00
Kelsey Gilbert
0a1a8b289d Bug 1812353 - Update GPUSupportedLimits in webgpu.webidl. r=webgpu-reviewers,webidl,saschanaz,jimb,emilio,smaug
* Add validation for requested features and devices for
adapter.requestDevice().
* Promote webgl's AutoAssertCast to mfbt/Casting.h/LazyAssertedCast.

Differential Revision: https://phabricator.services.mozilla.com/D177110
2023-06-12 21:10:11 +00:00
Stanca Serban
eba12e89d3 Backed out changeset 8352bc23343d (bug 1812353) for causing build bustages in Adapter.cpp. CLOSED TREE 2023-06-09 23:42:09 +03:00
Kelsey Gilbert
02035d2f32 Bug 1812353 - Update GPUSupportedLimits in webgpu.webidl. r=webgpu-reviewers,webidl,saschanaz,jimb,emilio,smaug
* Add validation for requested features and devices for
adapter.requestDevice().
* Promote webgl's AutoAssertCast to mfbt/Casting.h/LazyAssertedCast.

Differential Revision: https://phabricator.services.mozilla.com/D177110
2023-06-09 19:52:39 +00:00
Erich Gubler
c810122e43 Bug 1831263: fix(webgpu): remove strong ref. cycle b/w Compilation{Info,Message} r=webgpu-reviewers,jgilbert
Co-Authored-By: Kelsey Gilbert <jgilbert@mozilla.com>

Differential Revision: https://phabricator.services.mozilla.com/D179813
2023-06-05 16:47:54 +00:00
Erich Gubler
9a4d1b0bc7 Bug 1653164: refactor(webgpu): fix WGPUTextureDescriptor naming r=webgpu-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D177439
2023-05-10 19:29:32 +00:00
Stanca Serban
aad13fc5d1 Backed out 3 changesets (bug 1653164) for causing bp-nu bustages in Adapter.h. CLOSED TREE
Backed out changeset 938fa5409a7a (bug 1653164)
Backed out changeset 1b25345f09e5 (bug 1653164)
Backed out changeset 91185e96b467 (bug 1653164)
2023-05-10 07:59:41 +03:00
Erich Gubler
baec747a2c Bug 1653164: refactor(webgpu): fix WGPUTextureDescriptor naming r=webgpu-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D177439
2023-05-10 00:46:00 +00:00
Narcis Beleuzu
cf5ed4cf31 Backed out 3 changesets (bug 1653164) for build bustages on Adapter.h . CLOSED TREE
Backed out changeset 6f36f0a844be (bug 1653164)
Backed out changeset 86be7d9d8fa1 (bug 1653164)
Backed out changeset 984a479a81d8 (bug 1653164)
2023-05-10 01:42:57 +03:00
Erich Gubler
f3657072b3 Bug 1653164: refactor(webgpu): fix WGPUTextureDescriptor naming r=webgpu-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D177439
2023-05-09 21:47:34 +00:00
Stanca Serban
3d4efc87d5 Backed out 3 changesets (bug 1653164) for causing builds bustages in Adapter.h. CLOSED TREE
Backed out changeset 037d37f4eb71 (bug 1653164)
Backed out changeset 32ca1ab63d70 (bug 1653164)
Backed out changeset a996e5517aa1 (bug 1653164)
2023-05-09 21:43:27 +03:00
Erich Gubler
3f986c1547 Bug 1653164: refactor(webgpu): fix WGPUTextureDescriptor naming r=webgpu-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D177439
2023-05-09 17:47:26 +00:00
Erich Gubler
127f98832d Bug 1830336: fix(webgpu): support depth32float-stencil8 feature/texture format r=webgpu-reviewers,webidl,saschanaz,jimb
Differential Revision: https://phabricator.services.mozilla.com/D176710
2023-05-09 17:30:31 +00:00
Erich Gubler
6f81ad28d5 Bug 1831090: feat(webgpu): support rgb9e5ufloat texture r=webgpu-reviewers,webidl,saschanaz,jimb
Differential Revision: https://phabricator.services.mozilla.com/D177028
2023-05-09 17:21:34 +00:00
Erich Gubler
b6e3aca3a1 Bug 1826681: fix(webgpu): present label in shader comp. msgs. in console r=webgpu-reviewers,nical
This context is crucial for debugging, kthxbai.

Differential Revision: https://phabricator.services.mozilla.com/D175406
2023-04-22 04:23:57 +00:00
Erich Gubler
779eb69861 Bug 1826681: fix(webgpu): propagate label to new shader modules r=webgpu-reviewers,nical
We don't set the [`GPUObjectBase.label`] of the `shaderModule` we create in our implementation of [`GPUDevice.createShaderModule`], but we should. Fix it! You can see this reflected in the error diagnostics currently returned by Naga in the [`GPUCompilationMessage.message`] field.

[`GPUObjectBase.label`]: https://www.w3.org/TR/webgpu/#dom-gpuobjectbase-label
[`GPUDevice.createShaderModule`]: https://www.w3.org/TR/webgpu/#dom-gpudevice-createshadermodule
[`GPUCompilationMessage.message`]: https://www.w3.org/TR/webgpu/#dom-gpucompilationmessage-message

Differential Revision: https://phabricator.services.mozilla.com/D175405
2023-04-22 04:23:57 +00:00
Erich Gubler
fc1d16472b Bug 1826681: feat(webgpu): add sentinel shader compilation msg. in console r=webgpu-reviewers,nical
@jimb expressed concern that a collapsed group of compilation messages for WebGPU shaders in the JS console isn't easy enough to discern from scanning a console log manually. We can't associate a log level with the group itself (which would let us paint the group with color for contrast), unfortunately. So, we decided to have a "sentinel" message right before groups that uses the highest "severity" of message in the entire set of compilation messages.

Differential Revision: https://phabricator.services.mozilla.com/D175404
2023-04-22 04:23:57 +00:00
Erich Gubler
5b70d14a10 Bug 1826681: feat(webgpu): print counts of shader compilation messages by type r=webgpu-reviewers,nical
Refine the console group title for shader compilation messages by adding aggregated counts of each message by type.

Differential Revision: https://phabricator.services.mozilla.com/D175402
2023-04-22 04:23:57 +00:00
Erich Gubler
2f6d6f1418 Bug 1826681: feat(webgpu): log shader creation msgs. to console r=webgpu-reviewers,nical
Time to finally add some (barebones) diagnostics! When a user calls [`GPUDevice.createShaderModule`], if there are any messages returned:

1. Create a collapsed console group. Use a generic title for the console group (for now).
1. Inside the console group, print containing a log entry per message with a JS log level according to the message severity.

Differential Revision: https://phabricator.services.mozilla.com/D175303
2023-04-22 04:23:57 +00:00
Nicolas Silva
ac8100709d Bug 1829121 - Update wgpu to revision 25cb9f61e9a6be572ee42536bbe57aa5f759a700. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D176057
2023-04-21 15:39:25 +00:00
Cristian Tuns
f74d7b12b7 Backed out 5 changesets (bug 1826681) for causing build bustages in WebGPUChild.cpp/Device.cpp CLOSED TREE
Backed out changeset 17c9673361fc (bug 1826681)
Backed out changeset 47a2a358111e (bug 1826681)
Backed out changeset b71415253dd2 (bug 1826681)
Backed out changeset f99d74976f29 (bug 1826681)
Backed out changeset d2a6476fe2d4 (bug 1826681)
2023-04-20 22:36:10 -04:00
Erich Gubler
02415d8c6d Bug 1826681: fix(webgpu): present label in shader comp. msgs. in console r=webgpu-reviewers,nical
This context is crucial for debugging, kthxbai.

Differential Revision: https://phabricator.services.mozilla.com/D175406
2023-04-21 01:57:20 +00:00
Erich Gubler
fdce90b974 Bug 1826681: fix(webgpu): propagate label to new shader modules r=webgpu-reviewers,nical
We don't set the [`GPUObjectBase.label`] of the `shaderModule` we create in our implementation of [`GPUDevice.createShaderModule`], but we should. Fix it! You can see this reflected in the error diagnostics currently returned by Naga in the [`GPUCompilationMessage.message`] field.

[`GPUObjectBase.label`]: https://www.w3.org/TR/webgpu/#dom-gpuobjectbase-label
[`GPUDevice.createShaderModule`]: https://www.w3.org/TR/webgpu/#dom-gpudevice-createshadermodule
[`GPUCompilationMessage.message`]: https://www.w3.org/TR/webgpu/#dom-gpucompilationmessage-message

Differential Revision: https://phabricator.services.mozilla.com/D175405
2023-04-21 01:57:20 +00:00
Erich Gubler
378eac88f6 Bug 1826681: feat(webgpu): add sentinel shader compilation msg. in console r=webgpu-reviewers,nical
@jimb expressed concern that a collapsed group of compilation messages for WebGPU shaders in the JS console isn't easy enough to discern from scanning a console log manually. We can't associate a log level with the group itself (which would let us paint the group with color for contrast), unfortunately. So, we decided to have a "sentinel" message right before groups that uses the highest "severity" of message in the entire set of compilation messages.

Differential Revision: https://phabricator.services.mozilla.com/D175404
2023-04-21 01:57:20 +00:00
Erich Gubler
dace47474d Bug 1826681: feat(webgpu): print counts of shader compilation messages by type r=webgpu-reviewers,nical
Refine the console group title for shader compilation messages by adding aggregated counts of each message by type.

Differential Revision: https://phabricator.services.mozilla.com/D175402
2023-04-21 01:57:20 +00:00
Erich Gubler
f0220a08c3 Bug 1826681: feat(webgpu): log shader creation msgs. to console r=webgpu-reviewers,nical
Time to finally add some (barebones) diagnostics! When a user calls [`GPUDevice.createShaderModule`], if there are any messages returned:

1. Create a collapsed console group. Use a generic title for the console group (for now).
1. Inside the console group, print containing a log entry per message with a JS log level according to the message severity.

Differential Revision: https://phabricator.services.mozilla.com/D175303
2023-04-21 01:57:20 +00:00
Jim Blandy
694a54ff88 Bug 1821219: Update WebGPU.webidl for new automatic pipeline layout. r=webgpu-reviewers,webidl,teoxoy,smaug
Adapt WebGPU.webidl for [gpuweb#2657], which changed the way to request automatic pipeline layout: rather than simply omitting the `layout` property from the pipeline descriptor, you now need to say `layout: "auto"`.

[gpuweb#2657]: https://github.com/gpuweb/gpuweb/pull/2657/files

Differential Revision: https://phabricator.services.mozilla.com/D173495
2023-04-12 17:53:50 +00:00
Nicolas Silva
6847fd573b Bug 1814848 - Update wgpu to revision 41de797c745d317e93b9cf50e7446faff7f65954. r=webgpu-reviewers,jimb a=reland CLOSED TREE
Differential Revision: https://phabricator.services.mozilla.com/D168928
2023-02-07 18:08:29 +00:00
Csoregi Natalia
6a5f526e95 Backed out 3 changesets (bug 1814848) for causing address sanitizer fails in MOZ_Crash. CLOSED TREE
Backed out changeset 38ecc5076ab3 (bug 1814848)
Backed out changeset 7dd5ce12c5f3 (bug 1814848)
Backed out changeset 5c42f3352b26 (bug 1814848)
2023-02-07 23:10:17 +02:00
Nicolas Silva
d270dec459 Bug 1814848 - Update wgpu to revision 41de797c745d317e93b9cf50e7446faff7f65954. r=webgpu-reviewers,jimb
Differential Revision: https://phabricator.services.mozilla.com/D168928
2023-02-07 18:08:29 +00:00
Jim Blandy
4121cbf2d5 Bug 1799753: Use CopyUTF16toUTF8 for strings destined for cow_label. r=ErichDonGubler
In WebGPU, entry point names and labels from types like
`GPUComputePipelineDescriptor` eventually get turned into Rust `&str` values.

The prior code used `LossyCopyUTF16ToASCII` to produce `nsCString`s from the
`nsString`s received from the WebIDL bindings, and then passed the resulting
bytes to Rust `std::ffi::CStr::to_str`. Unfortunately, that "ASCII" actually
means Latin-1, so if the entry point named happened to be representable in
Latin-1 that happened not to be valid UTF-8, `wgpu_bindings::cow_label` would
return `None`, leading to a panic when unwrapped by
`wgpu_bindings::client::ProgrammableStageDescriptor::to_wgpu`.

The fix: just call `CopyUTF16ToUTF8` instead. This should always produce bytes
that `CStr::to_str` can consume. The WebIDL for WebGPU uses `USVString` for
entry point names and labels, so these values should never contain unpaired
surrogate code points, meaning that conversion should always succeed.

Differential Revision: https://phabricator.services.mozilla.com/D168188
2023-01-28 07:47:17 +00:00
Nicolas Silva
6d5e36bb9b Bug 1811284 - Update wgpu to 24a904256e225b20b11fb30f914ef53212a2909e. r=webgpu-reviewers,ErichDonGubler,jimb
Differential Revision: https://phabricator.services.mozilla.com/D167276
2023-01-24 09:24:03 +00:00
sotaro
623e2cb358 Bug 1805209 - Use RemoteTexture for WebGPU r=gfx-reviewers,lsalzman
WebGPU uses CompositableInProcessManager to push TextureHost directly from WebGPUParent to WebRender. But CompositableInProcessManager plumbing has a problem and caused Bug 1805209.

gecko already has a similar mechanism, called RemoteTextureMap. It is used in oop WebGL. If WebGPU uses RemoteTextureMap instead of CompositableInProcessManager, both WebGPU and oop WebGL use same mechanism.

WebGPUParent pushes a new texture to RemoteTextureMap. The RemoteTextureMap notifies the pushed texture to WebRenderImageHost.

Before the change, only one TextureHost is used for one swap chain. With the change, multiple TextureHosts are used for one swap chain with recycling.

The changes are followings.

- Use RemoteTextureMap instead of CompositableInProcessManager.
- Use RemoteTextureOwnerId instead of CompositableHandle.
- Use WebRenderCanvasData instead of WebRenderInProcessImageData.
- Add remote texture pushed callback functionality to RemoteTextureMap. With it, RemoteTextureMap notifies a new pushed remote texture to WebRenderImageHost.
- Remove CompositableInProcessManager.

Differential Revision: https://phabricator.services.mozilla.com/D164890
2022-12-23 20:41:02 +00:00
Andrew McCreight
188ac80e29 Bug 1805931, part 2 - Automated removal of uses of ROOT and UNROOT CC macros. r=smaug
As of the prior patch, these are no longer needed. I removed
these with a script, then ran clang-format on the files, then
manually reverted a few unrelated changed from the formatter.

Differential Revision: https://phabricator.services.mozilla.com/D164829
2022-12-15 19:45:01 +00:00
Nicolas Silva
71997c8154 Bug 1795311 - Use the new shmem classes in the WebGPU buffer impl. r=jgilbert
Depends on D159398

Differential Revision: https://phabricator.services.mozilla.com/D159399
2022-11-10 15:52:32 +00:00
Cristian Tuns
11403d75ae Backed out 2 changesets (bug 1795311) for causing build bustages on WebGPUParent.cpp CLOSED TREE
Backed out changeset 71697f876d88 (bug 1795311)
Backed out changeset 60b9bfda2e8b (bug 1795311)
2022-11-09 11:17:43 -05:00
Nicolas Silva
121eaa5f9a Bug 1795311 - Use the new shmem classes in the WebGPU buffer impl. r=jgilbert
Depends on D159398

Differential Revision: https://phabricator.services.mozilla.com/D159399
2022-11-09 14:30:16 +00:00
Nicolas Silva
bd05b4c260 Bug 1777535 - Use unsafe shmems. r=jimb
This commit makes WebGPU buffers use unsafe shmems.
Instead of relying on moving the shmem back and forth between the two processes to ensure thread safety, we instead rely on the validation done on both sides. The upside is that it makes it much easier to implement said validation correctly.

In the interest of splitting the buffer mapping rework into small-ish commits, this one puts some structural pieces in place but doesn't necessarily do justice to the final implementation:
 - The validation itself is coming in subsequent patches in this series.
 - Mapping sub-ranges of the buffer was somewhat implemented in some parts of the parent code and not in others, and was fairly broken as a whole. This commit always maps the entire buffer and proper logic for sub-ranges is coming in another commit.

The main things this commit does put in place:
 - Each mappable buffer is associated with a Shmem that is accessible to both sides.
 - On the child side, if a buffer is not mappable, then Buffer::mShmem is in its default state (it doesn't point to any shared memory segment).
 - On the parent side, if a buffer is not mappable it does not have an entry in mSharedMemoryMap.
 - The shmem is always created by the child and destroyed by the parent.

Depends on D151615

Differential Revision: https://phabricator.services.mozilla.com/D151616
2022-08-10 15:55:03 +00:00
Marian-Vasile Laza
19a23c8a56 Backed out 22 changesets (bug 1780792, bug 1778713, bug 1771254, bug 1777535) for causing bustages on WebGPUParent.h. CLOSED TREE
Backed out changeset 84974dbb4d3f (bug 1780792)
Backed out changeset 5bef755ea09b (bug 1777535)
Backed out changeset 6de84921e7d0 (bug 1780792)
Backed out changeset 89450745f60b (bug 1777535)
Backed out changeset de8da0f89c50 (bug 1777535)
Backed out changeset 24707519fe7b (bug 1771254)
Backed out changeset fe75bdc54a31 (bug 1777535)
Backed out changeset aa8e1c7f727f (bug 1777535)
Backed out changeset f674057a477f (bug 1777535)
Backed out changeset b4210142bf82 (bug 1780792)
Backed out changeset 326511661875 (bug 1780792)
Backed out changeset 6178c6dd5c31 (bug 1780792)
Backed out changeset 219760e8c20e (bug 1777535)
Backed out changeset e312cdad1fee (bug 1777535)
Backed out changeset 446e62674d9d (bug 1777535)
Backed out changeset d2f4d878d51f (bug 1777535)
Backed out changeset 85ac57add037 (bug 1777535)
Backed out changeset 4c512a0c05a9 (bug 1780792)
Backed out changeset 6f732421a0b4 (bug 1777535)
Backed out changeset 0da5289fe5a9 (bug 1777535)
Backed out changeset c19a35a62ed4 (bug 1778713)
Backed out changeset 61e4e8e63a3e (bug 1771254)
2022-08-10 15:04:12 +03:00
Nicolas Silva
52dc1bf73f Bug 1777535 - Use unsafe shmems. r=jimb
This commit makes WebGPU buffers use unsafe shmems.
Instead of relying on moving the shmem back and forth between the two processes to ensure thread safety, we instead rely on the validation done on both sides. The upside is that it makes it much easier to implement said validation correctly.

In the interest of splitting the buffer mapping rework into small-ish commits, this one puts some structural pieces in place but doesn't necessarily do justice to the final implementation:
 - The validation itself is coming in subsequent patches in this series.
 - Mapping sub-ranges of the buffer was somewhat implemented in some parts of the parent code and not in others, and was fairly broken as a whole. This commit always maps the entire buffer and proper logic for sub-ranges is coming in another commit.

The main things this commit does put in place:
 - Each mappable buffer is associated with a Shmem that is accessible to both sides.
 - On the child side, if a buffer is not mappable, then Buffer::mShmem is in its default state (it doesn't point to any shared memory segment).
 - On the parent side, if a buffer is not mappable it does not have an entry in mSharedMemoryMap.
 - The shmem is always created by the child and destroyed by the parent.

Depends on D151615

Differential Revision: https://phabricator.services.mozilla.com/D151616
2022-08-10 11:38:53 +00:00
Nicolas Silva
711966e43e Bug 1750576 - Avoid passing raw strings in a couple of wgpu bindings entry points. r=emilio
Inspired by emilio's suggestion in the shader module API patch. This tries to be the most straightforward way to go from the strings coming from IPC to the ones consumed by wgpu.

Differential Revision: https://phabricator.services.mozilla.com/D151024
2022-07-08 08:11:39 +00:00
Nicolas Silva
9b27095b07 Bug 1750576 - WebGPU shader module asynchronous CompilationInfo API. r=aosmond,emilio
This patch is a lot of plumbing for not that much functionality. The goal is to align CreateShaderModule's error reporting with the spec.
Creating a shader module is now a dedicated async IPDL message returning the compilation info so that it can be exposed as a promise by the WebGPU API.

Differential Revision: https://phabricator.services.mozilla.com/D146817
2022-07-08 08:11:39 +00:00
Cristian Tuns
86c321ca45 Backed out 2 changesets (bug 1750576) for causing lint failures and build bustages. CLOSED TREE
Backed out changeset 21ede22c4113 (bug 1750576)
Backed out changeset be7493c6f3cb (bug 1750576)
2022-07-07 10:51:38 -04:00
Nicolas Silva
8b6ccb9427 Bug 1750576 - Avoid passing raw strings in a couple of wgpu bindings entry points. r=emilio
Inspired by emilio's suggestion in the shader module API patch. This tries to be the most straightforward way to go from the strings coming from IPC to the ones consumed by wgpu.

Differential Revision: https://phabricator.services.mozilla.com/D151024
2022-07-07 14:35:29 +00:00
Nicolas Silva
e070f8027b Bug 1750576 - WebGPU shader module asynchronous CompilationInfo API. r=aosmond,emilio
This patch is a lot of plumbing for not that much functionality. The goal is to align CreateShaderModule's error reporting with the spec.
Creating a shader module is now a dedicated async IPDL message returning the compilation info so that it can be exposed as a promise by the WebGPU API.

Differential Revision: https://phabricator.services.mozilla.com/D146817
2022-07-07 14:35:28 +00:00
Narcis Beleuzu
4a6560373f Backed out changeset 0a2e3c4ca14f (bug 1750576) for bustages on RefPtr . CLOSED TREE 2022-07-06 19:18:20 +03:00
Nicolas Silva
8a69d97904 Bug 1750576 - WebGPU shader module asynchronous CompilationInfo API. r=aosmond,emilio
This patch is a lot of plumbing for not that much functionality. The goal is to align CreateShaderModule's error reporting with the spec.
Creating a shader module is now a dedicated async IPDL message returning the compilation info so that it can be exposed as a promise by the WebGPU API.

Differential Revision: https://phabricator.services.mozilla.com/D146817
2022-07-06 15:22:59 +00:00
Jim Blandy
da2b5a67de Bug 1752188: Move GPUBufferDescriptor validation to server. r=jgilbert
Depends on [`wgpu#2673`].

WebGPU requires `GPUBufferDescriptor` validation failure to:

1) generate an error on the Device timeline, and

2) mark the new buffer as invalid.

Satisfy 1) by moving most validation to the compositor process.

Requirement 2) is harder. `wgpu_core::Global::device_create_buffer`
already takes care of some validation for us, and marks the provided
buffer id invalid when there's a problem. However, there are certain
errors the spec requires us to detect which `device_create_buffer`
cannot even see, because they are caught by standard Rust validation
steps in the process of creating the `wgpu_types::BufferDescriptor`
that one would *pass to* that function. For example, if there are
bogus bits set in the `usage` property, we can't even construct a Rust
`BufferUsages` value from that to include in the `BufferDescriptor`
that we must pass to `device_create_buffer`.

This means that we need to do some validation ourselves, in the
process of constructing that `BufferDescriptor`, and use the
`Global::create_buffer_error` method added in [`wgpu#2673`] to mark
the new buffer as invalid.

[`wgpu#2673`]: https://github.com/gfx-rs/wgpu/pull/2673

Differential Revision: https://phabricator.services.mozilla.com/D146768
2022-06-06 06:33:13 +00:00