Commit Graph

153 Commits

Author SHA1 Message Date
Teodor Tanasoaia
0fe761f3af Bug 1822096 - [webgpu] add plumbing for pipeline-overridable constants. r=webgpu-reviewers,webidl,smaug,nical,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D208010
2024-04-23 08:21:07 +00:00
Erich Gubler
741760b5f2 Bug 1877488: feat(webgpu): make GPUProgrammableStage.entryPoint optional r=webgpu-reviewers,webidl,nical,saschanaz
Tested with <https://06wj.github.io/WebGPU-Playground/#/Samples/HelloPoint1>, removing the lines with `entryPoint: "main"` on them.

Differential Revision: https://phabricator.services.mozilla.com/D203231
2024-03-04 15:35:09 +00:00
Peter Van der Beken
9e9199880e Bug 1640839 - Stop generating a sentinel value at the end of WebIDL enums. r=mccr8,jgilbert,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D201344
2024-03-02 07:50:25 +00:00
Natalia Csoregi
10b9ceb789 Backed out 13 changesets (bug 1640839) for causing bustage on Element.cpp CLOSED TREE
Backed out changeset 179ceb82c9e5 (bug 1640839)
Backed out changeset 73f498a821f0 (bug 1640839)
Backed out changeset dc2d3d0e0365 (bug 1640839)
Backed out changeset ddc989ac0509 (bug 1640839)
Backed out changeset e595bb3feea8 (bug 1640839)
Backed out changeset c85aca04e27f (bug 1640839)
Backed out changeset 98e8e3a4047a (bug 1640839)
Backed out changeset 59ef180517db (bug 1640839)
Backed out changeset af2f5e293662 (bug 1640839)
Backed out changeset 89aa6d9dc598 (bug 1640839)
Backed out changeset 67b722a722f9 (bug 1640839)
Backed out changeset 24a9665c6ced (bug 1640839)
Backed out changeset d93f199385e9 (bug 1640839)
2024-03-01 18:23:08 +02:00
Peter Van der Beken
e0fa109cb0 Bug 1640839 - Stop generating a sentinel value at the end of WebIDL enums. r=mccr8,jgilbert,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D201344
2024-03-01 14:31:15 +00:00
Nicolas Silva
eecbbcf3e4 Bug 1881067 - Pass maxAnisotropy in SamplerDescriptor. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D202235
2024-02-22 08:50:30 +00:00
Nicolas Silva
70dc43f909 Bug 1881063 - Add GPUStorageTextureAccess read-only and read-write. r=webgpu-reviewers,webidl,smaug,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D202234
2024-02-22 08:50:29 +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
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
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
228b78e4e7 Bug 1809567: Propagate promise creation failures in mozilla::webgpu::Device::CreateShaderModule. r=webgpu-reviewers,webidl,smaug,saschanaz,ErichDonGubler
If creation of the `CompilationInfo` promise fails in
`mozilla::webgpu::Device::CreateShaderModule`, propagate the error
properly, rather than leaving a local `ErrorResult` unhandled.

Differential Revision: https://phabricator.services.mozilla.com/D197600
2024-01-06 17:06:19 +00:00
Noemi Erli
4a16eaedd4 Backed out changeset e8af82a85a88 (bug 1809567) for causing crashtests in 1809567.html CLOSED TREE 2024-01-06 01:37:02 +02:00
Jim Blandy
024a17587c Bug 1809567: Propagate promise creation failures in mozilla::webgpu::Device::CreateShaderModule. r=webgpu-reviewers,webidl,smaug,saschanaz,ErichDonGubler
If creation of the `CompilationInfo` promise fails in
`mozilla::webgpu::Device::CreateShaderModule`, propagate the error
properly, rather than leaving a local `ErrorResult` unhandled.

Differential Revision: https://phabricator.services.mozilla.com/D197600
2024-01-05 22:38:28 +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
Brad Werth
ad675e8c0a Bug 1816731 Part 1: Prevent configuration of a WebGPU context for a too-big canvas. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D193567
2023-11-17 16:11:40 +00:00
sotaro
b8aa658666 Bug 1856787 - Add a capability to present WebGPU without readback on Windows r=webgpu-reviewers,nical
For presenting WebGPU without readback, wgpu does rendering to ExternalTexture. Then the ExternalTexture is pushed to RemoteTextureMap for present.

With DX12, ExternalTextureD3D11 is implemented for gecko side implementation. ExternalTextureWgpu holds necessary resource that is necessary by wgpu. ExternalTextureWgpu is created and destroyed by gecko side's ExternalTexture.

Presenting current texture starts at CanvasContext::SwapChainPresent(). CanvasContext::SwapChainPresent() posts current texture for present. And the current texture is set invalid, since the texture is going to be posted to WebRender. Next CanvasContext::GetCurrentTexture() call creates a new texture of swap chain.

WebGPUParent::RecvSwapChainPresent() receives present request. It pushes to RemoteTextureMap for presenting.

TextureRaw is recycled with ExternalTexture recycling.

Differential Revision: https://phabricator.services.mozilla.com/D190249
2023-10-24 04:04:07 +00:00
Brad Werth
47f376df07 Bug 1859825: Ensure that WebGPU Buffers are only dropped once. r=webgpu-reviewers,nical
In addition to moving the valid check earlier in Buffer::Drop, this
patch also ensures that Device clears the tracked buffers set after they
have been unmapped, and cleans up the error handling in Device::GetLost.

Differential Revision: https://phabricator.services.mozilla.com/D191565
2023-10-23 15:48:55 +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
Erich Gubler
7f8fff28a9 Bug 1828123: docs(webgpu): note bug for color space support r=webgpu-reviewers,teoxoy
Depends on D185101

Differential Revision: https://phabricator.services.mozilla.com/D185102
2023-08-11 17:07:07 +00:00
Erich Gubler
2d98892707 Bug 1828123: refactor(webgpu)!: rename GPUCanvasConfiguration's alpha mode field to match spec. r=webgpu-reviewers,webidl,teoxoy,smaug,saschanaz
Depends on D185100

Differential Revision: https://phabricator.services.mozilla.com/D185101
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
Kelsey Gilbert
e2ab4b228f Bug 1838739 - Initialize result of SetAsGPUOutOfMemoryError. r=webgpu-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D181161
2023-06-16 18:16:28 +00:00
Stanca Serban
101f37ec56 Backed out changeset 0ec4b06c796a (bug 1838739) for causing build bustages in OutOfMemoryError.h 2023-06-16 19:43:19 +03:00
Kelsey Gilbert
b50cdc8174 Bug 1838739 - Initialize result of SetAsGPUOutOfMemoryError. r=webgpu-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D181161
2023-06-16 16:21:57 +00:00
Cosmin Sabou
225519ffa4 Backed out changeset 8599db8132f9 (bug 1838739) for causing build bustages on OutOfMemoryError.h. 2023-06-16 01:04:05 +03:00
Kelsey Gilbert
198710f6bc Bug 1838739 - Initialize result of SetAsGPUOutOfMemoryError. r=webgpu-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D181161
2023-06-15 21:36:23 +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
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
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