Commit graph

153 commits

Author SHA1 Message Date
Teodor Tanasoaia
14c29e0bbd 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
552db8371a 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
62bdf442eb 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
8c2521e9d5 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
763356e4fb 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
c95586d579 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
6f88ae91de 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
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
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
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
5ad3692e95 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
18c7d61db6 Backed out changeset e8af82a85a88 (bug 1809567) for causing crashtests in 1809567.html CLOSED TREE 2024-01-06 01:37:02 +02:00
Jim Blandy
33c15c6978 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
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
Brad Werth
5b918272ea 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
e8b67b7765 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
987879b702 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
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
Erich Gubler
cf37d4a62b 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
f047567796 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
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
Kelsey Gilbert
f2bc14357b 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
0d0e04555d Backed out changeset 0ec4b06c796a (bug 1838739) for causing build bustages in OutOfMemoryError.h 2023-06-16 19:43:19 +03:00
Kelsey Gilbert
da36186386 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
55958495ea Backed out changeset 8599db8132f9 (bug 1838739) for causing build bustages on OutOfMemoryError.h. 2023-06-16 01:04:05 +03:00
Kelsey Gilbert
d2f43615a9 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
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
Kelsey Gilbert
8ce110a8e9 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
0fb34553d5 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
7f8803cf62 Backed out changeset 8352bc23343d (bug 1812353) for causing build bustages in Adapter.cpp. CLOSED TREE 2023-06-09 23:42:09 +03:00