← All reports

WebGPU IPC bind-group-layout entry serialization (refactor)

Component: WebKit WebGPU IPC | 94fa535

Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutDescriptor.cpp

- Vector<BindGroupLayoutEntry> entries;
- entries.reserveInitialCapacity(bindGroupLayoutDescriptor.entries.size());
- for (const auto& entry : bindGroupLayoutDescriptor.entries) {
- auto convertedEntry = convertToBacking(entry);
- ...
+ return { { { bindGroupLayoutDescriptor.label }, Vector<BindGroupLayoutEntry> { bindGroupLayoutDescriptor.entries } } };
...
- for (const auto& backingEntry : borrow(bindGroupLayoutDescriptor.entries)) {
- auto entry = convertFromBacking(backingEntry);
- ...
+ entries = bindGroupLayoutDescriptor.entries;

Source/WebKit/Shared/WebGPU/WebGPUBindGroupLayoutEntry.h

-struct BindGroupLayoutEntry { ... };
+using BindGroupLayoutEntry = ::WebGPU::BindGroupLayoutEntry;

A bind group layout descriptor declares the resources a shader can bind — buffers, samplers, textures, storage textures, external textures — with per-entry binding index, stage visibility and type parameters, and every decoded field is attacker-controlled from the GPU process's point of view. The IPC copies of BindGroupLayoutEntry and its five binding-layout types now alias the ::WebGPU value types, serialized directly by their .serialization.in files; six converter files are deleted and descriptor converters copy the entries Vector wholesale.

The WebContent-to-GPU path for bind group layouts is now defined by the generated IPC encoder/decoder alone, with no hand-written conversion layer in between. The old converters were pass-through copies, so validation behavior is effectively unchanged.

Narrow: check that each .serialization.in field list matches every member of the ::WebGPU structs, since a missed or reordered field would leave it default-initialized on the GPU side, and whether the ::WebGPU structs carry padding or default member initializers that differ from the old IPC structs. Wider: trace whether the Metal-side createBindGroupLayout validates entries with several or none of buffer/sampler/texture/storageTexture/externalTexture set, binding-index uniqueness, minBindingSize and per-stage limits — a question sharpened by this week's [1] and the duplicate-@binding fix in 9589788. Also review the Vector copy in convertFromBacking for large entry counts and the lifetime of span-borrowed entries against the caller.