Repository navigation
Commit b6ab04a
committed
WebGPU: Make WebCore and WebKit use WebGPU C++ API
https://bugs.webkit.org/show_bug.cgi?id=326477
rdar://189269291
Reviewed by Mike Wyrzykowski.
Make the WebGPU C++ API (WebGPU/WebGPUCpp.h, namespace WebGPU) the
interface between WebCore / WebKit and the WebGPU implementations.
WebCore and WebKit no longer call any wgpu* function or use any WGPU*
type.
The WebCore::WebGPU enums, flags and value structs are replaced by the
C++ API types. Their values on the wire do not change.
For every WebGPU object type X (Adapter, Device, Queue, Buffer, Texture,
TextureView, Sampler, QuerySet, ExternalTexture, ShaderModule,
BindGroupLayout, PipelineLayout, BindGroup, ComputePipeline,
RenderPipeline, CommandEncoder, CommandBuffer, the pass encoders,
RenderBundleEncoder, RenderBundle, PresentationContext, Instance and the
XR objects):
- WebCore::GPUX holds a Ref<WebGPU::X>, and its descriptor converts to
the WebGPU::XDescriptor. Descriptors borrow their arrays as spans, so
the conversion keeps the element storage alive for the call.
- WebKit::RemoteXProxy implements WebGPU::X in the Web Process.
- WebKit::RemoteX holds the WebGPU::Metal::X, held as WebGPU::X.
- The IPC converters target the WebGPU types. Descriptors without object
handles are sent as the API structs.
- WebCore::WebGPU::XImpl and the isRemoteXProxy() / isXImpl() type
checks are removed.
The WebCore::WebGPU namespace, the WebCore C API conversion helpers
(WebGPUConvertToBackingContext, WebGPUDowncastConvertToBackingContext,
WebGPUPtr.h, WebGPUAPIUtilities.h) and the InternalAPI directory are
removed. WGPU_LARGE_BUFFER_SIZE becomes WebGPU::largeBufferSize outside
the framework.
The API bases have no label(), so WebCore::GPUX stores the label. It
starts as the label of the descriptor, as the GPU Process path already
did. In-process objects used to start with an empty label.
WebCore keeps the types that refer to WebCore objects:
- The queue and device commands that take an ImageBuffer, a VideoFrame
or a media player are on WebCore::WebGPUIntegration, which holds the
WebGPU::Instance.
- WebCore::WebGPUCompositorIntegration connects the canvas to the
presentation context.
- WebCore::WebGPUXRLayerBacking adapts a WebGPU::XRProjectionLayer for
WebXR.
- The descriptors that WebCore holds on to, such as the pipeline
descriptors kept for asynchronous creation, are WebCore::WebGPU<Name>
types. They convert to the API descriptors in free functions.
Behaviour changes:
- Unknown GPUBufferUsage bits become WebGPU::BufferUsage::Invalid and
fail validation. Before, bits from bit 16 up were dropped.
- A color write mask with more than the four channel bits becomes
WebGPU::ColorWrite::Invalid and fails validation.
- unconfigure() of a canvas reaches the presentation context, which
recreates its render buffers on the next configure().
- The canvas size is passed in WebGPU::CanvasConfiguration from
configure() instead of setSize() from the compositor.
The framework is compiled with ARC, and WebCore and WebKit are not.
RetainPtr<T> is a different type under ARC, so the callable signatures
of the API take raw CF references or spans, never RetainPtr.
WebCore and WebKit include the API through <WebCore/WebGPUCppAPI.h> and
not <WebGPU/WebGPUCpp.h> directly. The header map resolves WebGPUCpp.h
to its source path, which is in no clang module, so whichever
WebCore_Private submodule included it first owned the types in the Swift
build.
Tests: fast/webgpu and http/tests/webgpu cover the converted paths.
Long change list skipped.
Canonical link: https://commits.webkit.org/323962@main1 parent bf08b69 commit b6ab04a
737 files changed
Lines changed: 6875 additions & 22024 deletions
File tree
- Source
- WebCore
- Modules
- WebGPU
- Implementation
- InternalAPI
- webxr
- WebCore.xcodeproj
- inspector
- agents
- page
- platform
- WebGPU
- WebGPU.xcodeproj
- WebGPU
- Internal
- WebKitLegacy/mac/WebCoreSupport
- WebKit
- GPUProcess/graphics
- Model
- WebGPU
- Scripts
- webkit
- UIProcess
- Cocoa
- XR
- WebKit.xcodeproj
- WebProcess
- GPU/graphics
- WebGPU
- cocoa
- Model
- WebCoreSupport
- XR
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
2882 | 2881 | | |
2883 | 2882 | | |
2884 | 2883 | | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
2885 | 2893 | | |
2886 | 2894 | | |
2887 | 2895 | | |
| |||
3311 | 3319 | | |
3312 | 3320 | | |
3313 | 3321 | | |
3314 | | - | |
| 3322 | + | |
3315 | 3323 | | |
3316 | 3324 | | |
3317 | 3325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
147 | 180 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | 181 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | 182 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 183 | | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | 184 | | |
320 | 185 | | |
321 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
0 commit comments