Commit graph

195 commits

Author SHA1 Message Date
Nicolas Silva
d66485ea0f 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
2e32b894f8 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
1e9ab5af40 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
7c0d0c224a 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
009438fb43 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
02b7d3567c 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
ca240b5d7c 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
2e31c742bb 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
d305040887 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
c13234b7b6 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
e9af9019a2 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
ba1f477697 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
0d8234abb4 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
dde8080f39 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
82db99ca27 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
2a985ab10d 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
ef1cc3bc73 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
d78d441952 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
99c1c1bf48 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
641595bece 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
758ac4cc26 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
d2164ebef0 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
e88f442492 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
000c9b4bb4 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
a7237754b4 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
87097f8bed 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
b428472b9e 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
d8ba26f353 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
bba51332bd 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
872b8a500d 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
20f995376c 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
52d53561f0 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
fa82ebd5e1 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
3290ce6472 Backed out changeset ba49d9bdc665 (bug 1852485) for causing non-unified build bustages at ExternalTextureD3D11.cpp. 2023-09-15 16:21:08 +03:00
sotaro
a8dfa5bebe 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
fa8bfb6bc7 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
fbcf43a0af 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
8cf85839a4 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
260a0b100c 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
8a0b708983 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
c005dbec80 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
8b84555cc4 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
1953484601 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
693fc63076 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
52c1392325 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
9358586530 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
a8574159c8 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
8820a3ea9e 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
Noemi Erli
8107df398a Backed out changeset 9e72228ed1e3 (bug 1772557) for causing failures in test_too_many_color_attachments.html CLOSED TREE
removed dom/webgpu/mochitest/test_too_many_color_attachments.html
2023-06-15 00:42:32 +03:00
Jim Blandy
c19156348e 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 20:21:13 +00:00