Commit Graph

197 Commits

Author SHA1 Message Date
Jim Blandy
c57ff07601 Bug 1913121: Update wgpu to c6a3d9273 (2024-08-13) r=webgpu-reviewers,supply-chain-reviewers,ErichDonGubler,teoxoy
Adapt `wgpu_server_queue_submit` to the new submission index
type.

Use corrected spelling `WGPUTextureFormat_Rg11b10UFloat`.

Assign queue ids explicitly, rather than deriving them from device ids:

- `wgpu_bindings::client::IdentityHub`: add an `IdentityManager` for queues.
  Initialize it in `IdentityHub::default`.

- `dom::webgpu::DeviceRequest`: hold separate `mDeviceId` and `mQueueId`
  members.

- `wgpu_client_make_device_id`: rename to `wgpu_client_make_device_queue_id`,
  and have it allocate both a device id and a queue id.

- `PWebGPU` protocol's `AdapterRequestDevice` request: explicitly pass
  an id for the new queue.

- `WebGPUChild::AdapterRequestDevice`: pass through the queue id from
  `wgpu_client_make_device_queue_id` through to `SendAdapterRequestDevice`,
  and also return it as `DeviceRequest::mQueueId`.

- `WebGPUParent::RecvAdapterRequestDevice`: accept a queue id, and pass
  it along to `ffi::wgpu_server_adapter_request_device`.

- `wgpu_server_adapter_request_device`: take a new argument specifying the
  new queue's id, and pass that along to `global.adapter_request_device`.

- `dom::webgpu::Adapter::RequestDevice`: given the `DeviceRequest` returned by
  `WebGPUChild::AdapterRequestDevice`, pass the ids for both the new device and
  the new queue to `dom::webgpu::Device::Device`.

- Let `dom::webgpu::Device::Device` take a new argument explicitly specifying
  the device's queue's id.

Differential Revision: https://phabricator.services.mozilla.com/D219356
2024-08-19 18:46:19 +00:00
Teodor Tanasoaia
1b026522e8 Bug 1906679 - Update wgpu to revision c5e4bfa5a15069a8ec08c9081e511ec15efa92e8. r=webgpu-reviewers,supply-chain-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D216375
2024-07-15 21:38:15 +00:00
Nicolas Silva
e411bce9ed Bug 1889873 - Remove IsOpen in favor of CanSend. r=webgpu-reviewers,teoxoy
They are the same and the latter is more self explanatory.
The patch also addresses a couple of Cleanup methods where I forgot to check the bridge pointer.

Differential Revision: https://phabricator.services.mozilla.com/D206785
2024-04-05 15:59:38 +00:00
Erich Gubler
20396799f0 Bug 1883478: chore(webgpu): prepend Uncaptured WebGPU error: to uncaptured errs. r=webgpu-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D203503
2024-03-06 21:01:47 +00:00
Nicolas Silva
f48166d78b Bug 1880081 - Don't crash the content process if the GPU process goes down. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D201715
2024-02-13 16:57:08 +00:00
Brad Werth
567429f7fb Bug 1865921 Part 1: Make WebGPUParent supply a device lost callback. r=ErichDonGubler,webgpu-reviewers,nical
This patch makes several changes:

1) It modifies WebGPUParent::RecvAdapterRequestDevice to additionally
send a device lost callback to wgpu. The user data for this callback is
stored within WebGPUParent as a hash of unique_ptr memory, which allows
for the possibility that wgpu will not call the callback (though it
should). When the callback is received, this memory is cleared. When the
WebGPUParent is destroyed, it asserts that there is no remaining held
memory for pending callbacks. These callbacks also check a WeakPtr to
the parent as additional safety.

2) It corrects some behavior in Device::ResolveLost where checking the
existence of the underlying JS object is moved earlier, since later
operations on the promise require the JS object to exist.

Differential Revision: https://phabricator.services.mozilla.com/D194310
2024-01-26 20:03:17 +00:00
Iulian Moraru
07bd3c9704 Backed out 2 changesets (bug 1865921) for causing Bug 1876663. CLOSED TREE
Backed out changeset 46b5a7e46018 (bug 1865921)
Backed out changeset dbb08bccb5e3 (bug 1865921)
2024-01-26 13:25:40 +02:00
Brad Werth
491fd1da4f Bug 1865921 Part 1: Make WebGPUParent supply a device lost callback. r=ErichDonGubler,webgpu-reviewers,nical
This patch makes several changes:

1) It modifies WebGPUParent::RecvAdapterRequestDevice to additionally
send a device lost callback to wgpu. The user data for this callback is
stored within WebGPUParent as a hash of unique_ptr memory, which allows
for the possibility that wgpu will not call the callback (though it
should). When the callback is received, this memory is cleared. When the
WebGPUParent is destroyed, it asserts that there is no remaining held
memory for pending callbacks. These callbacks also check a WeakPtr to
the parent as additional safety.

2) It corrects some behavior in Device::ResolveLost where checking the
existence of the underlying JS object is moved earlier, since later
operations on the promise require the JS object to exist.

Differential Revision: https://phabricator.services.mozilla.com/D194310
2024-01-25 23:52:24 +00:00
Natalia Csoregi
2335d7e1fe Backed out 2 changesets (bug 1865921) for causing failures on test_device_lost.html. CLOSED TREE
Backed out changeset 39cf0feca383 (bug 1865921)
Backed out changeset b0f89dfa3291 (bug 1865921)
2024-01-24 03:18:18 +02:00
Brad Werth
065868ade6 Bug 1865921 Part 1: Make WebGPUParent supply a device lost callback. r=ErichDonGubler,webgpu-reviewers,nical
This patch makes several changes:

1) It modifies WebGPUParent::RecvAdapterRequestDevice to additionally
send a device lost callback to wgpu. The user data for this callback is
stored within WebGPUParent as a hash of unique_ptr memory, which allows
for the possibility that wgpu will not call the callback (though it
should). When the callback is received, this memory is cleared. When the
WebGPUParent is destroyed, it asserts that there is no remaining held
memory for pending callbacks. These callbacks also check a WeakPtr to
the parent as additional safety.

2) It corrects some behavior in Device::ResolveLost where checking the
existence of the underlying JS object is moved earlier, since later
operations on the promise require the JS object to exist.

Differential Revision: https://phabricator.services.mozilla.com/D194310
2024-01-24 00:39:30 +00:00
sotaro
e9996baad0 Bug 1863474 - Add a capability of handling ID3D11Fence and ID3D12Fence handling to WebGPU r=webgpu-reviewers,nical
This is preparation for Bug 1843891.

ID3D11Fence and ID3D12Fence handling is necessary to interoperate between D3D11 and D3D12. Necessary fence value can be obtained from wgpu_server_queue_submit().

Differential Revision: https://phabricator.services.mozilla.com/D193619
2024-01-23 02:41:49 +00:00
Nicolas Silva
7563a27051 Bug 1873047 - Move CommandEncoder and RenderBundleEncoder ::Finish to their respective file. r=webgpu-reviewers,ErichDonGubler
Depends on D198401

Differential Revision: https://phabricator.services.mozilla.com/D198402
2024-01-20 01:18:59 +00:00
Nicolas Silva
c0784f2e7e Bug 1873047 - Generate a valid RenderPipeline object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D198400

Differential Revision: https://phabricator.services.mozilla.com/D198401
2024-01-20 01:18:59 +00:00
Nicolas Silva
4e0f601dd5 Bug 1873047 - Generate a valid ComputePipeline object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D198387

Differential Revision: https://phabricator.services.mozilla.com/D198400
2024-01-20 01:18:58 +00:00
Nicolas Silva
2026d799c5 Bug 1873047 - Generate a valid PipelineLayout object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D198386

Differential Revision: https://phabricator.services.mozilla.com/D198387
2024-01-20 01:18:58 +00:00
Nicolas Silva
5984b6a544 Bug 1873047 - Generate a valid CommandEncoder object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D198385

Differential Revision: https://phabricator.services.mozilla.com/D198386
2024-01-20 01:18:57 +00:00
Nicolas Silva
07d56a1414 Bug 1873047 - Generate a valid ShaderModule object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D198384

Differential Revision: https://phabricator.services.mozilla.com/D198385
2024-01-20 01:18:57 +00:00
Nicolas Silva
479581f823 Bug 1873047 - Generate a valid BindGroup object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D198383

Differential Revision: https://phabricator.services.mozilla.com/D198384
2024-01-20 01:18:57 +00:00
Nicolas Silva
1480aa203d Bug 1873047 - Generate a valid BindGroupLayout object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D197801

Differential Revision: https://phabricator.services.mozilla.com/D198383
2024-01-20 01:18:56 +00:00
Nicolas Silva
29b24a2b74 Bug 1873047 - Generate a valid TextureView object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
Depends on D197800

Differential Revision: https://phabricator.services.mozilla.com/D197801
2024-01-20 01:18:56 +00:00
Nicolas Silva
e73a26fd5c Bug 1873047 - Generate a valid Texture object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
These JS proxies are always safe to create. The ids are validated on the other side so if the GPU process comes back up and we try to use the object (on a new device), it will generate an error as expected.

Depends on D197799

Differential Revision: https://phabricator.services.mozilla.com/D197800
2024-01-20 01:18:55 +00:00
Nicolas Silva
447e8b6125 Bug 1873047 - Generate a valid Sampler object on the JS side even if IPC is down. r=webgpu-reviewers,ErichDonGubler
These JS proxies are always safe to create. The ids are validated on the other side so if the GPU process comes back up and we try to use the object (on a new device), it will generate an error as expected.

Differential Revision: https://phabricator.services.mozilla.com/D197799
2024-01-20 01:18:55 +00:00
Jim Blandy
041c2694b4 Bug 1872898: Remove redundant MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION attributes. r=saschanaz
The `mozilla::webgpu::Device::CreateShaderModule` and
`mozilla::webgpu::WebGPUChild::DeviceCreateShaderModule` definitions
do not need `MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION` attributes, because
their declarations in the class bodies already have
`MOZ_CAN_RUN_SCRIPT` attributes.

Differential Revision: https://phabricator.services.mozilla.com/D197605
2024-01-03 19:58:23 +00:00
Nicolas Silva
798bd0c194 Bug 1865364 - Ensure a buffer's ID can't be zero. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D193920
2023-11-22 14:15:36 +00:00
Brad Werth
477b5fb8b0 Bug 1861985 - Let the parent process handle validating command encoders. r=webgpu-reviewers,webidl,saschanaz,jimb
This makes sure we never create an invalid (zero) ID after incorrect usage of a command encoder.
It also simplifies the code. The JS object should not do any validaion (per spec) and simply forward the commands to the parent process where all of the validation is done.

Differential Revision: https://phabricator.services.mozilla.com/D192839
2023-11-22 14:15:35 +00:00
Natalia Csoregi
5ea22ebe90 Backed out 4 changesets (bug 1861985, bug 1860958, bug 1865364) for causing bustage due to CommandEncoder. CLOSED TREE
Backed out changeset 3d6b04449863 (bug 1865364)
Backed out changeset 1e35eb31a789 (bug 1861985)
Backed out changeset e3f53b794c1d (bug 1861985)
Backed out changeset d676e8a3a515 (bug 1860958)
2023-11-22 13:52:44 +02:00
Nicolas Silva
d369f1e328 Bug 1865364 - Ensure a buffer's ID can't be zero. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D193920
2023-11-22 10:57:58 +00:00
Brad Werth
3861222f6b Bug 1861985 - Let the parent process handle validating command encoders. r=webgpu-reviewers,webidl,saschanaz,jimb
This makes sure we never create an invalid (zero) ID after incorrect usage of a command encoder.
It also simplifies the code. The JS object should not do any validaion (per spec) and simply forward the commands to the parent process where all of the validation is done.

Differential Revision: https://phabricator.services.mozilla.com/D192839
2023-11-22 10:57:57 +00:00
Cristian Tuns
7ecd49983c Backed out 3 changesets (bug 1861985, bug 1860958) for causing build bustages in RefPtr.h CLOSED TREE
Backed out changeset 13f07117425f (bug 1861985)
Backed out changeset 0bdc4c60018e (bug 1861985)
Backed out changeset 5e6f2b2e19c6 (bug 1860958)
2023-11-21 14:07:35 -05:00
Brad Werth
a551810dd5 Bug 1861985 - Let the parent process handle validating command encoders. r=webgpu-reviewers,webidl,saschanaz,jimb
This makes sure we never create an invalid (zero) ID after incorrect usage of a command encoder.
It also simplifies the code. The JS object should not do any validaion (per spec) and simply forward the commands to the parent process where all of the validation is done.

Differential Revision: https://phabricator.services.mozilla.com/D192839
2023-11-21 18:16:25 +00:00
Brad Werth
63a9c3b59d Bug 1861751 Part 1: Don't attempt bind group entries for buffers with id 0. r=webgpu-reviewers,ErichDonGubler
Buffers that are created in lost Devices are given the id 0. Don't
attempt to bind these buffers in bind broup entries.

Differential Revision: https://phabricator.services.mozilla.com/D192286
2023-11-03 16:03:21 +00:00
Brad Werth
c61c8a63d2 Bug 1838693 Part 3: Make GPUDevice::Destroy() trigger wgpu device_destroy, then device_drop. r=webgpu-reviewers,nical
This treats destroy as a 2-step process: wait on the destroy, then drop.

Differential Revision: https://phabricator.services.mozilla.com/D190238
2023-10-16 15:32:00 +00:00
Brad Werth
5f35ef841c Bug 1838693 Part 2: Rationalize GPUDevice lost promise handling. r=webgpu-reviewers,nical
This ensures that both internal and external triggers of "lose the
device" resolve the lost promise using the same code path.

Differential Revision: https://phabricator.services.mozilla.com/D190129
2023-10-16 15:32:00 +00:00
Brad Werth
50e117837a Bug 1838693 Part 1: Stub in 'lose the device' and trigger it on device lost errors. r=webgpu-reviewers,nical
This creates a WebGPUParent::LoseDevice entry point, which informs the
WebGPUChild that the device has been lost. The child side is largely a
stub, as a later part will rationalize the handling of the device.lost
promise in the child.

This also expands ErrorBufferType with a DeviceLost value. The
LoseDevice function is triggered for any error where webgpu_bindings
HasErrorBufferType error_type returns ErrorBufferType::DeviceLost.

Differential Revision: https://phabricator.services.mozilla.com/D188388
2023-10-16 15:31:59 +00:00
sotaro
71ca0a896c Bug 1852485 - Present WebGPU by using DX11 texture in swap chain with readback on Windows r=webgpu-reviewers,nical
The change is preparation for Bug 1843891.
Current gecko uses a internal texture for SwapChain's texture. This bug changes as to use external dx11 texture for WebGPU dx12 backend on Windows.

WebGPUParent allocates dx11 texture for SwapChain's texture of dx12 backend WebGPU. wgpu uses the dx11 texture as ID3D12Resource. The readback for presenting to WebRender still exists.
The change handles only RBGA format.

Differential Revision: https://phabricator.services.mozilla.com/D187870
2023-09-17 18:42:07 +00:00
Cosmin Sabou
da23f82150 Backed out changeset ba49d9bdc665 (bug 1852485) for causing non-unified build bustages at ExternalTextureD3D11.cpp. 2023-09-15 16:21:08 +03:00
sotaro
c2ac1fd434 Bug 1852485 - Present WebGPU by using DX11 texture in swap chain with readback on Windows r=webgpu-reviewers,nical
The change is preparation for Bug 1843891.
Current gecko uses a internal texture for SwapChain's texture. This bug changes as to use external dx11 texture for WebGPU dx12 backend on Windows.

WebGPUParent allocates dx11 texture for SwapChain's texture of dx12 backend WebGPU. wgpu uses the dx11 texture as ID3D12Resource. The readback for presenting to WebRender still exists.
The change handles only RBGA format.

Differential Revision: https://phabricator.services.mozilla.com/D187870
2023-09-15 11:14:51 +00:00
Markus Stange
755a0de1c3 Bug 1851263 - Rename nsIGlobalObject::AsInnerWindow to GetAsInnerWindow because it can return null. r=smaug
This is also the name that was originally suggested in https://bugzilla.mozilla.org/show_bug.cgi?id=218415#c53 .

Differential Revision: https://phabricator.services.mozilla.com/D187340
2023-09-04 04:06:30 +00:00
Erich Gubler
e9f569ed34 Bug 1814088: feat(webgpu): implement GPUQueue.onSubmittedWorkDone r=webgpu-reviewers,webidl,smaug,nical
Differential Revision: https://phabricator.services.mozilla.com/D186175
2023-08-17 14:34:42 +00:00
Erich Gubler
3b2f147bf7 Bug 1828123: fix(webgpu)!: rename GPUPrimitiveState.clampDepth to unclippedDepth to match spec., plumb through to WGPU r=webgpu-reviewers,webidl,teoxoy,smaug,saschanaz
Depends on D185099

Differential Revision: https://phabricator.services.mozilla.com/D185100
2023-08-11 17:07:06 +00:00
Erich Gubler
fdb35e5902 Bug 1838694: fix(webgpu): impl. correct GPUError types r=jgilbert,webgpu-reviewers,webidl,peterv
Differential Revision: https://phabricator.services.mozilla.com/D181690
2023-07-06 20:50:52 +00:00
Iulian Moraru
92d7bc5e11 Backed out 3 changesets (bug 1838694) for causing webgpu failures. CLOSED TREE
Backed out changeset 8f7835cd7d0c (bug 1838694)
Backed out changeset 7fdcca116760 (bug 1838694)
Backed out changeset 83d3204888fd (bug 1838694)
2023-07-05 19:48:43 +03:00
Erich Gubler
40bf83dc2c Bug 1838694: fix(webgpu): impl. correct GPUError types r=jgilbert,webgpu-reviewers,webidl,peterv
Differential Revision: https://phabricator.services.mozilla.com/D181690
2023-07-05 14:16:40 +00:00
Stanca Serban
f38d9850c7 Backed out 3 changesets (bug 1838694) for causing mochitests failures in test_interfaces_secureContext.html. CLOSED TREE
Backed out changeset 892fed91da4e (bug 1838694)
Backed out changeset f6477420370e (bug 1838694)
Backed out changeset 109ebd10d0c3 (bug 1838694)
2023-06-29 00:46:26 +03:00
Erich Gubler
5e01577dfa Bug 1838694: fix(webgpu): impl. correct GPUError types r=jgilbert,webgpu-reviewers,webidl,peterv
Differential Revision: https://phabricator.services.mozilla.com/D181690
2023-06-28 19:29:17 +00:00
Nicolas Silva
f7ad5f97c4 Bug 1837990 - Depduplicate code to calculate a texture's format's block size. r=webgpu-reviewers,teoxoy
Differential Revision: https://phabricator.services.mozilla.com/D180818
2023-06-15 21:22:54 +00:00
Nicolas Silva
5472eeba15 Bug 1837990 - Expose stencil8 and depth16unorm texture formats. r=webgpu-reviewers,webidl,teoxoy,saschanaz.
Differential Revision: https://phabricator.services.mozilla.com/D180699
2023-06-15 21:22:54 +00:00
Nicolas Silva
f5070550db Bug 1837990 - Rename texture format Rg11b10float into Rg11b10ufloat. r=webgpu-reviewers,webidl,teoxoy,saschanaz,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D180698
2023-06-15 21:22:54 +00:00
Nicolas Silva
6661966fa7 Bug 1773723 - Pass viewFormats to wgpu. r=webgpu-reviewers,webidl,saschanaz,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D180691
2023-06-15 21:22:53 +00:00
Jim Blandy
687c4fe125 Bug 1772557: Assign WebGPU RenderBundles ids even if encoding fails. r=webgpu-reviewers,ErichDonGubler
In `RenderBundleEncoder::Finish`, never construct RenderBundles with
an id of zero, as this will cause a panic in the GPU process when we
deserialize command buffers that refer to such bundles.

Instead, assign the invalid RenderBundle an id, and report to the GPU
process that this id is associated with an error.

Differential Revision: https://phabricator.services.mozilla.com/D177077
2023-06-14 23:33:29 +00:00