Skip to content
Permalink
Browse files
[WebGPU] Connect JS bindings code to internal WebGPU interface
https://bugs.webkit.org/show_bug.cgi?id=232804

Reviewed by Dean Jackson.

Source/WebCore:

We have the Javascript bindings code for WebGPU, and we have our internal interface
for WebGPU too (https://bugs.webkit.org/show_bug.cgi?id=232792). The internal interface
is a bunch of virtual classes. This code hookes up the two of them, so calling a
Javascript bindings function will end up calling through to our internal interface.

The strategy to connect them is to give each of the bindings objects a Ref of its backing
interface, which is passed in to its create() function. When JS calls a method of one of
these objects, the bindings object will just forward the call on through its backing
Ref.

In order for this to work, there have to be a bunch of converter functions for all the
descriptor dictionaries which are used as arguments to methods. The converter functions
convert the bindings dictionary to the relevant internal struct. These methods are all
called convertToBacking(), and for struct types, they're member functions of the struct,
and for enum types and typedef types, they are standalone functions.

So, for a bindings method foo(descriptorDictionary), this gets turned into:
m_backing->foo(descriptorDictionary.convertToBacking()).

No new tests because there is no behavior change yet.

* Modules/WebGPU/GPU.cpp:
(WebCore::convertToBacking):
(WebCore::GPU::requestAdapter):
* Modules/WebGPU/GPU.h:
(WebCore::GPU::create):
(WebCore::GPU::backing):
(WebCore::GPU::backing const):
(WebCore::GPU::GPU):
* Modules/WebGPU/GPUAdapter.cpp:
(WebCore::GPUAdapter::name const):
(WebCore::GPUAdapter::features const):
(WebCore::GPUAdapter::limits const):
(WebCore::GPUAdapter::isFallbackAdapter const):
(WebCore::convertToBacking):
(WebCore::GPUAdapter::requestDevice):
* Modules/WebGPU/GPUAdapter.h:
(WebCore::GPUAdapter::create):
(WebCore::GPUAdapter::backing):
(WebCore::GPUAdapter::backing const):
(WebCore::GPUAdapter::GPUAdapter):
* Modules/WebGPU/GPUAddressMode.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUBindGroup.cpp:
(WebCore::GPUBindGroup::label const):
(WebCore::GPUBindGroup::setLabel):
* Modules/WebGPU/GPUBindGroup.h:
(WebCore::GPUBindGroup::create):
(WebCore::GPUBindGroup::backing):
(WebCore::GPUBindGroup::backing const):
(WebCore::GPUBindGroup::GPUBindGroup):
* Modules/WebGPU/GPUBindGroupDescriptor.h:
(WebCore::GPUBindGroupDescriptor::convertToBacking const):
* Modules/WebGPU/GPUBindGroupEntry.h:
(WebCore::convertToBacking):
(WebCore::GPUBindGroupEntry::convertToBacking const):
* Modules/WebGPU/GPUBindGroupLayout.cpp:
(WebCore::GPUBindGroupLayout::label const):
(WebCore::GPUBindGroupLayout::setLabel):
* Modules/WebGPU/GPUBindGroupLayout.h:
(WebCore::GPUBindGroupLayout::create):
(WebCore::GPUBindGroupLayout::backing):
(WebCore::GPUBindGroupLayout::backing const):
(WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
* Modules/WebGPU/GPUBindGroupLayoutDescriptor.h:
(WebCore::GPUBindGroupLayoutDescriptor::convertToBacking const):
* Modules/WebGPU/GPUBindGroupLayoutEntry.h:
(WebCore::GPUBindGroupLayoutEntry::convertToBacking const):
* Modules/WebGPU/GPUBlendComponent.h:
(WebCore::GPUBlendComponent::convertToBacking const):
* Modules/WebGPU/GPUBlendFactor.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUBlendOperation.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUBlendState.h:
(WebCore::GPUBlendState::convertToBacking const):
* Modules/WebGPU/GPUBuffer.cpp:
(WebCore::GPUBuffer::label const):
(WebCore::GPUBuffer::setLabel):
(WebCore::GPUBuffer::mapAsync):
(WebCore::GPUBuffer::getMappedRange):
(WebCore::GPUBuffer::unmap):
(WebCore::GPUBuffer::destroy):
* Modules/WebGPU/GPUBuffer.h:
(WebCore::GPUBuffer::create):
(WebCore::GPUBuffer::backing):
(WebCore::GPUBuffer::backing const):
(WebCore::GPUBuffer::GPUBuffer):
* Modules/WebGPU/GPUBufferBinding.h:
(WebCore::GPUBufferBinding::convertToBacking const):
* Modules/WebGPU/GPUBufferBindingLayout.h:
(WebCore::GPUBufferBindingLayout::convertToBacking const):
* Modules/WebGPU/GPUBufferBindingType.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUBufferDescriptor.h:
(WebCore::GPUBufferDescriptor::convertToBacking const):
* Modules/WebGPU/GPUBufferUsage.h:
(WebCore::convertBufferUsageFlagsToBacking):
* Modules/WebGPU/GPUCanvasCompositingAlphaMode.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUCanvasConfiguration.h:
(WebCore::GPUCanvasConfiguration::convertToBacking const):
* Modules/WebGPU/GPUColorDict.h:
(WebCore::GPUColorDict::convertToBacking const):
(WebCore::convertToBacking):
* Modules/WebGPU/GPUColorTargetState.h:
(WebCore::GPUColorTargetState::convertToBacking const):
* Modules/WebGPU/GPUColorWrite.h:
(WebCore::convertColorWriteFlagsToBacking):
* Modules/WebGPU/GPUCommandBuffer.cpp:
(WebCore::GPUCommandBuffer::label const):
(WebCore::GPUCommandBuffer::setLabel):
* Modules/WebGPU/GPUCommandBuffer.h:
(WebCore::GPUCommandBuffer::create):
(WebCore::GPUCommandBuffer::backing):
(WebCore::GPUCommandBuffer::backing const):
(WebCore::GPUCommandBuffer::GPUCommandBuffer):
* Modules/WebGPU/GPUCommandBufferDescriptor.h:
(WebCore::GPUCommandBufferDescriptor::convertToBacking const):
* Modules/WebGPU/GPUCommandEncoder.cpp:
(WebCore::GPUCommandEncoder::label const):
(WebCore::GPUCommandEncoder::setLabel):
(WebCore::GPUCommandEncoder::beginRenderPass):
(WebCore::GPUCommandEncoder::beginComputePass):
(WebCore::GPUCommandEncoder::copyBufferToBuffer):
(WebCore::GPUCommandEncoder::copyBufferToTexture):
(WebCore::GPUCommandEncoder::copyTextureToBuffer):
(WebCore::GPUCommandEncoder::copyTextureToTexture):
(WebCore::GPUCommandEncoder::fillBuffer):
(WebCore::GPUCommandEncoder::pushDebugGroup):
(WebCore::GPUCommandEncoder::popDebugGroup):
(WebCore::GPUCommandEncoder::insertDebugMarker):
(WebCore::GPUCommandEncoder::writeTimestamp):
(WebCore::GPUCommandEncoder::resolveQuerySet):
(WebCore::convertToBacking):
(WebCore::GPUCommandEncoder::finish):
* Modules/WebGPU/GPUCommandEncoder.h:
(WebCore::GPUCommandEncoder::create):
(WebCore::GPUCommandEncoder::backing):
(WebCore::GPUCommandEncoder::backing const):
(WebCore::GPUCommandEncoder::GPUCommandEncoder):
* Modules/WebGPU/GPUCommandEncoderDescriptor.h:
(WebCore::GPUCommandEncoderDescriptor::convertToBacking const):
* Modules/WebGPU/GPUCompareFunction.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUCompilationInfo.cpp:
(WebCore::GPUCompilationInfo::messages const):
* Modules/WebGPU/GPUCompilationInfo.h:
(WebCore::GPUCompilationInfo::create):
(WebCore::GPUCompilationInfo::backing):
(WebCore::GPUCompilationInfo::backing const):
(WebCore::GPUCompilationInfo::GPUCompilationInfo):
* Modules/WebGPU/GPUCompilationMessage.cpp:
(WebCore::GPUCompilationMessage::message const):
(WebCore::GPUCompilationMessage::type const):
(WebCore::GPUCompilationMessage::lineNum const):
(WebCore::GPUCompilationMessage::linePos const):
(WebCore::GPUCompilationMessage::offset const):
(WebCore::GPUCompilationMessage::length const):
* Modules/WebGPU/GPUCompilationMessage.h:
(WebCore::GPUCompilationMessage::create):
(WebCore::GPUCompilationMessage::backing):
(WebCore::GPUCompilationMessage::backing const):
(WebCore::GPUCompilationMessage::GPUCompilationMessage):
* Modules/WebGPU/GPUCompilationMessageType.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUComputePassDescriptor.h:
(WebCore::GPUComputePassDescriptor::convertToBacking const):
* Modules/WebGPU/GPUComputePassEncoder.cpp:
(WebCore::GPUComputePassEncoder::label const):
(WebCore::GPUComputePassEncoder::setLabel):
(WebCore::GPUComputePassEncoder::setPipeline):
(WebCore::GPUComputePassEncoder::dispatch):
(WebCore::GPUComputePassEncoder::dispatchIndirect):
(WebCore::GPUComputePassEncoder::beginPipelineStatisticsQuery):
(WebCore::GPUComputePassEncoder::endPipelineStatisticsQuery):
(WebCore::GPUComputePassEncoder::endPass):
(WebCore::GPUComputePassEncoder::setBindGroup):
(WebCore::GPUComputePassEncoder::pushDebugGroup):
(WebCore::GPUComputePassEncoder::popDebugGroup):
(WebCore::GPUComputePassEncoder::insertDebugMarker):
* Modules/WebGPU/GPUComputePassEncoder.h:
(WebCore::GPUComputePassEncoder::create):
(WebCore::GPUComputePassEncoder::backing):
(WebCore::GPUComputePassEncoder::backing const):
(WebCore::GPUComputePassEncoder::GPUComputePassEncoder):
* Modules/WebGPU/GPUComputePassTimestampLocation.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUComputePassTimestampWrite.h:
(WebCore::GPUComputePassTimestampWrite::convertToBacking const):
(WebCore::convertToBacking):
* Modules/WebGPU/GPUComputePipeline.cpp:
(WebCore::GPUComputePipeline::label const):
(WebCore::GPUComputePipeline::setLabel):
(WebCore::GPUComputePipeline::getBindGroupLayout):
* Modules/WebGPU/GPUComputePipeline.h:
(WebCore::GPUComputePipeline::create):
(WebCore::GPUComputePipeline::backing):
(WebCore::GPUComputePipeline::backing const):
(WebCore::GPUComputePipeline::GPUComputePipeline):
* Modules/WebGPU/GPUComputePipelineDescriptor.h:
(WebCore::GPUComputePipelineDescriptor::convertToBacking const):
* Modules/WebGPU/GPUCullMode.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUDepthStencilState.h:
(WebCore::GPUDepthStencilState::convertToBacking const):
* Modules/WebGPU/GPUDevice.cpp:
(WebCore::GPUDevice::label const):
(WebCore::GPUDevice::setLabel):
(WebCore::GPUDevice::features const):
(WebCore::GPUDevice::limits const):
(WebCore::GPUDevice::destroy):
(WebCore::GPUDevice::createBuffer):
(WebCore::GPUDevice::createTexture):
(WebCore::convertToBacking):
(WebCore::GPUDevice::createSampler):
(WebCore::GPUDevice::importExternalTexture):
(WebCore::GPUDevice::createBindGroupLayout):
(WebCore::GPUDevice::createPipelineLayout):
(WebCore::GPUDevice::createBindGroup):
(WebCore::GPUDevice::createShaderModule):
(WebCore::GPUDevice::createComputePipeline):
(WebCore::GPUDevice::createRenderPipeline):
(WebCore::GPUDevice::createComputePipelineAsync):
(WebCore::GPUDevice::createRenderPipelineAsync):
(WebCore::GPUDevice::createCommandEncoder):
(WebCore::GPUDevice::createRenderBundleEncoder):
(WebCore::GPUDevice::createQuerySet):
(WebCore::GPUDevice::pushErrorScope):
(WebCore::GPUDevice::popErrorScope):
* Modules/WebGPU/GPUDevice.h:
(WebCore::GPUDevice::create):
(WebCore::GPUDevice::backing):
(WebCore::GPUDevice::backing const):
(WebCore::GPUDevice::GPUDevice):
(WebCore::GPUDevice::m_backing):
* Modules/WebGPU/GPUDeviceDescriptor.h:
(WebCore::GPUDeviceDescriptor::convertToBacking const):
* Modules/WebGPU/GPUDeviceLostInfo.cpp:
(WebCore::GPUDeviceLostInfo::reason const):
(WebCore::GPUDeviceLostInfo::message const):
(WebCore::GPUDeviceLostInfo::GPUDeviceLostInfo): Deleted.
* Modules/WebGPU/GPUDeviceLostInfo.h:
(WebCore::GPUDeviceLostInfo::create):
(WebCore::GPUDeviceLostInfo::backing):
(WebCore::GPUDeviceLostInfo::backing const):
(WebCore::GPUDeviceLostInfo::GPUDeviceLostInfo):
* Modules/WebGPU/GPUDeviceLostReason.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUErrorFilter.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUExtent3DDict.h:
(WebCore::GPUExtent3DDict::convertToBacking const):
(WebCore::convertToBacking):
* Modules/WebGPU/GPUExternalTexture.cpp:
(WebCore::GPUExternalTexture::label const):
(WebCore::GPUExternalTexture::setLabel):
* Modules/WebGPU/GPUExternalTexture.h:
(WebCore::GPUExternalTexture::create):
(WebCore::GPUExternalTexture::backing):
(WebCore::GPUExternalTexture::backing const):
(WebCore::GPUExternalTexture::GPUExternalTexture):
* Modules/WebGPU/GPUExternalTextureBindingLayout.h:
(WebCore::GPUExternalTextureBindingLayout::convertToBacking const):
* Modules/WebGPU/GPUExternalTextureDescriptor.h:
(WebCore::GPUExternalTextureDescriptor::convertToBacking const):
* Modules/WebGPU/GPUFeatureName.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUFilterMode.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUFragmentState.h:
(WebCore::GPUFragmentState::convertToBacking const):
* Modules/WebGPU/GPUFrontFace.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUImageCopyBuffer.h:
(WebCore::GPUImageCopyBuffer::convertToBacking const):
* Modules/WebGPU/GPUImageCopyExternalImage.h:
(WebCore::GPUImageCopyExternalImage::convertToBacking const):
* Modules/WebGPU/GPUImageCopyTexture.h:
(WebCore::GPUImageCopyTexture::convertToBacking const):
* Modules/WebGPU/GPUImageCopyTextureTagged.h:
(WebCore::GPUImageCopyTextureTagged::convertToBacking const):
* Modules/WebGPU/GPUImageDataLayout.h:
(WebCore::GPUImageDataLayout::convertToBacking const):
* Modules/WebGPU/GPUIndexFormat.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPULoadOp.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUMapMode.h:
(WebCore::convertMapModeFlagsToBacking):
* Modules/WebGPU/GPUMultisampleState.h:
(WebCore::GPUMultisampleState::convertToBacking const):
* Modules/WebGPU/GPUObjectDescriptorBase.h:
(WebCore::GPUObjectDescriptorBase::convertToBacking const):
* Modules/WebGPU/GPUOrigin2DDict.h:
(WebCore::GPUOrigin2DDict::convertToBacking const):
(WebCore::convertToBacking):
* Modules/WebGPU/GPUOrigin3DDict.h:
(WebCore::GPUOrigin3DDict::convertToBacking const):
(WebCore::convertToBacking):
* Modules/WebGPU/GPUOutOfMemoryError.h:
(WebCore::GPUOutOfMemoryError::create):
(WebCore::GPUOutOfMemoryError::backing):
(WebCore::GPUOutOfMemoryError::backing const):
(WebCore::GPUOutOfMemoryError::GPUOutOfMemoryError):
* Modules/WebGPU/GPUPipelineDescriptorBase.h:
(WebCore::GPUPipelineDescriptorBase::convertToBacking const):
* Modules/WebGPU/GPUPipelineLayout.cpp:
(WebCore::GPUPipelineLayout::label const):
(WebCore::GPUPipelineLayout::setLabel):
* Modules/WebGPU/GPUPipelineLayout.h:
(WebCore::GPUPipelineLayout::create):
(WebCore::GPUPipelineLayout::backing):
(WebCore::GPUPipelineLayout::backing const):
(WebCore::GPUPipelineLayout::GPUPipelineLayout):
* Modules/WebGPU/GPUPipelineLayoutDescriptor.h:
(WebCore::GPUPipelineLayoutDescriptor::convertToBacking const):
* Modules/WebGPU/GPUPipelineStatisticName.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUPowerPreference.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUPredefinedColorSpace.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUPrimitiveState.h:
(WebCore::GPUPrimitiveState::convertToBacking const):
* Modules/WebGPU/GPUPrimitiveTopology.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUProgrammableStage.h:
(WebCore::GPUProgrammableStage::convertToBacking const):
* Modules/WebGPU/GPUQuerySet.cpp:
(WebCore::GPUQuerySet::label const):
(WebCore::GPUQuerySet::setLabel):
(WebCore::GPUQuerySet::destroy):
* Modules/WebGPU/GPUQuerySet.h:
(WebCore::GPUQuerySet::create):
(WebCore::GPUQuerySet::backing):
(WebCore::GPUQuerySet::backing const):
(WebCore::GPUQuerySet::GPUQuerySet):
* Modules/WebGPU/GPUQuerySetDescriptor.h:
(WebCore::GPUQuerySetDescriptor::convertToBacking const):
* Modules/WebGPU/GPUQueryType.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUQueue.cpp:
(WebCore::GPUQueue::label const):
(WebCore::GPUQueue::setLabel):
(WebCore::GPUQueue::submit):
(WebCore::GPUQueue::onSubmittedWorkDone):
(WebCore::GPUQueue::writeBuffer):
(WebCore::GPUQueue::writeTexture):
(WebCore::GPUQueue::copyExternalImageToTexture):
* Modules/WebGPU/GPUQueue.h:
(WebCore::GPUQueue::create):
(WebCore::GPUQueue::backing):
(WebCore::GPUQueue::backing const):
(WebCore::GPUQueue::GPUQueue):
* Modules/WebGPU/GPURenderBundle.cpp:
(WebCore::GPURenderBundle::label const):
(WebCore::GPURenderBundle::setLabel):
* Modules/WebGPU/GPURenderBundle.h:
(WebCore::GPURenderBundle::create):
(WebCore::GPURenderBundle::backing):
(WebCore::GPURenderBundle::backing const):
(WebCore::GPURenderBundle::GPURenderBundle):
* Modules/WebGPU/GPURenderBundleDescriptor.h:
(WebCore::GPURenderBundleDescriptor::convertToBacking const):
* Modules/WebGPU/GPURenderBundleEncoder.cpp:
(WebCore::GPURenderBundleEncoder::label const):
(WebCore::GPURenderBundleEncoder::setLabel):
(WebCore::GPURenderBundleEncoder::setPipeline):
(WebCore::GPURenderBundleEncoder::setIndexBuffer):
(WebCore::GPURenderBundleEncoder::setVertexBuffer):
(WebCore::GPURenderBundleEncoder::draw):
(WebCore::GPURenderBundleEncoder::drawIndexed):
(WebCore::GPURenderBundleEncoder::drawIndirect):
(WebCore::GPURenderBundleEncoder::drawIndexedIndirect):
(WebCore::GPURenderBundleEncoder::setBindGroup):
(WebCore::GPURenderBundleEncoder::pushDebugGroup):
(WebCore::GPURenderBundleEncoder::popDebugGroup):
(WebCore::GPURenderBundleEncoder::insertDebugMarker):
(WebCore::convertToBacking):
(WebCore::GPURenderBundleEncoder::finish):
* Modules/WebGPU/GPURenderBundleEncoder.h:
(WebCore::GPURenderBundleEncoder::create):
(WebCore::GPURenderBundleEncoder::backing):
(WebCore::GPURenderBundleEncoder::backing const):
(WebCore::GPURenderBundleEncoder::GPURenderBundleEncoder):
* Modules/WebGPU/GPURenderBundleEncoderDescriptor.h:
(WebCore::GPURenderBundleEncoderDescriptor::convertToBacking const):
* Modules/WebGPU/GPURenderPassColorAttachment.h:
(WebCore::GPURenderPassColorAttachment::convertToBacking const):
* Modules/WebGPU/GPURenderPassDepthStencilAttachment.h:
(WebCore::GPURenderPassDepthStencilAttachment::convertToBacking const):
* Modules/WebGPU/GPURenderPassDescriptor.h:
(WebCore::GPURenderPassDescriptor::convertToBacking const):
* Modules/WebGPU/GPURenderPassEncoder.cpp:
(WebCore::GPURenderPassEncoder::label const):
(WebCore::GPURenderPassEncoder::setLabel):
(WebCore::GPURenderPassEncoder::setPipeline):
(WebCore::GPURenderPassEncoder::setIndexBuffer):
(WebCore::GPURenderPassEncoder::setVertexBuffer):
(WebCore::GPURenderPassEncoder::draw):
(WebCore::GPURenderPassEncoder::drawIndexed):
(WebCore::GPURenderPassEncoder::drawIndirect):
(WebCore::GPURenderPassEncoder::drawIndexedIndirect):
(WebCore::GPURenderPassEncoder::setBindGroup):
(WebCore::GPURenderPassEncoder::pushDebugGroup):
(WebCore::GPURenderPassEncoder::popDebugGroup):
(WebCore::GPURenderPassEncoder::insertDebugMarker):
(WebCore::GPURenderPassEncoder::setViewport):
(WebCore::GPURenderPassEncoder::setScissorRect):
(WebCore::GPURenderPassEncoder::setBlendConstant):
(WebCore::GPURenderPassEncoder::setStencilReference):
(WebCore::GPURenderPassEncoder::beginOcclusionQuery):
(WebCore::GPURenderPassEncoder::endOcclusionQuery):
(WebCore::GPURenderPassEncoder::beginPipelineStatisticsQuery):
(WebCore::GPURenderPassEncoder::endPipelineStatisticsQuery):
(WebCore::GPURenderPassEncoder::executeBundles):
(WebCore::GPURenderPassEncoder::endPass):
* Modules/WebGPU/GPURenderPassEncoder.h:
(WebCore::GPURenderPassEncoder::create):
(WebCore::GPURenderPassEncoder::backing):
(WebCore::GPURenderPassEncoder::backing const):
(WebCore::GPURenderPassEncoder::GPURenderPassEncoder):
* Modules/WebGPU/GPURenderPassLayout.h:
(WebCore::GPURenderPassLayout::convertToBacking const):
* Modules/WebGPU/GPURenderPassTimestampLocation.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPURenderPassTimestampWrite.h:
(WebCore::GPURenderPassTimestampWrite::convertToBacking const):
(WebCore::convertToBacking):
* Modules/WebGPU/GPURenderPipeline.cpp:
(WebCore::GPURenderPipeline::label const):
(WebCore::GPURenderPipeline::setLabel):
(WebCore::GPURenderPipeline::getBindGroupLayout):
* Modules/WebGPU/GPURenderPipeline.h:
(WebCore::GPURenderPipeline::create):
(WebCore::GPURenderPipeline::backing):
(WebCore::GPURenderPipeline::backing const):
(WebCore::GPURenderPipeline::GPURenderPipeline):
* Modules/WebGPU/GPURenderPipelineDescriptor.h:
(WebCore::GPURenderPipelineDescriptor::convertToBacking const):
* Modules/WebGPU/GPURequestAdapterOptions.h:
(WebCore::GPURequestAdapterOptions::convertToBacking const):
* Modules/WebGPU/GPUSampler.cpp:
(WebCore::GPUSampler::label const):
(WebCore::GPUSampler::setLabel):
* Modules/WebGPU/GPUSampler.h:
(WebCore::GPUSampler::create):
(WebCore::GPUSampler::backing):
(WebCore::GPUSampler::backing const):
(WebCore::GPUSampler::GPUSampler):
* Modules/WebGPU/GPUSamplerBindingLayout.h:
(WebCore::GPUSamplerBindingLayout::convertToBacking const):
* Modules/WebGPU/GPUSamplerBindingType.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUSamplerDescriptor.h:
(WebCore::GPUSamplerDescriptor::convertToBacking const):
* Modules/WebGPU/GPUShaderModule.cpp:
(WebCore::GPUShaderModule::label const):
(WebCore::GPUShaderModule::setLabel):
(WebCore::GPUShaderModule::compilationInfo):
* Modules/WebGPU/GPUShaderModule.h:
(WebCore::GPUShaderModule::create):
(WebCore::GPUShaderModule::backing):
(WebCore::GPUShaderModule::backing const):
(WebCore::GPUShaderModule::GPUShaderModule):
* Modules/WebGPU/GPUShaderModuleDescriptor.h:
(WebCore::GPUShaderModuleDescriptor::convertToBacking const):
* Modules/WebGPU/GPUShaderStage.h:
(WebCore::convertShaderStageFlagsToBacking):
* Modules/WebGPU/GPUStencilFaceState.h:
(WebCore::GPUStencilFaceState::convertToBacking const):
* Modules/WebGPU/GPUStencilOperation.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUStorageTextureAccess.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUStorageTextureBindingLayout.h:
(WebCore::GPUStorageTextureBindingLayout::convertToBacking const):
* Modules/WebGPU/GPUStoreOp.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUSupportedFeatures.cpp:
(WebCore::GPUSupportedFeatures::initializeSetLike const):
* Modules/WebGPU/GPUSupportedFeatures.h:
(WebCore::GPUSupportedFeatures::create):
(WebCore::GPUSupportedFeatures::backing):
(WebCore::GPUSupportedFeatures::backing const):
(WebCore::GPUSupportedFeatures::GPUSupportedFeatures):
* Modules/WebGPU/GPUSupportedLimits.cpp:
(WebCore::GPUSupportedLimits::maxTextureDimension1D const):
(WebCore::GPUSupportedLimits::maxTextureDimension2D const):
(WebCore::GPUSupportedLimits::maxTextureDimension3D const):
(WebCore::GPUSupportedLimits::maxTextureArrayLayers const):
(WebCore::GPUSupportedLimits::maxBindGroups const):
(WebCore::GPUSupportedLimits::maxDynamicUniformBuffersPerPipelineLayout const):
(WebCore::GPUSupportedLimits::maxDynamicStorageBuffersPerPipelineLayout const):
(WebCore::GPUSupportedLimits::maxSampledTexturesPerShaderStage const):
(WebCore::GPUSupportedLimits::maxSamplersPerShaderStage const):
(WebCore::GPUSupportedLimits::maxStorageBuffersPerShaderStage const):
(WebCore::GPUSupportedLimits::maxStorageTexturesPerShaderStage const):
(WebCore::GPUSupportedLimits::maxUniformBuffersPerShaderStage const):
(WebCore::GPUSupportedLimits::maxUniformBufferBindingSize const):
(WebCore::GPUSupportedLimits::maxStorageBufferBindingSize const):
(WebCore::GPUSupportedLimits::minUniformBufferOffsetAlignment const):
(WebCore::GPUSupportedLimits::minStorageBufferOffsetAlignment const):
(WebCore::GPUSupportedLimits::maxVertexBuffers const):
(WebCore::GPUSupportedLimits::maxVertexAttributes const):
(WebCore::GPUSupportedLimits::maxVertexBufferArrayStride const):
(WebCore::GPUSupportedLimits::maxInterStageShaderComponents const):
(WebCore::GPUSupportedLimits::maxComputeWorkgroupStorageSize const):
(WebCore::GPUSupportedLimits::maxComputeInvocationsPerWorkgroup const):
(WebCore::GPUSupportedLimits::maxComputeWorkgroupSizeX const):
(WebCore::GPUSupportedLimits::maxComputeWorkgroupSizeY const):
(WebCore::GPUSupportedLimits::maxComputeWorkgroupSizeZ const):
(WebCore::GPUSupportedLimits::maxComputeWorkgroupsPerDimension const):
* Modules/WebGPU/GPUSupportedLimits.h:
(WebCore::GPUSupportedLimits::create):
(WebCore::GPUSupportedLimits::backing):
(WebCore::GPUSupportedLimits::backing const):
(WebCore::GPUSupportedLimits::GPUSupportedLimits):
* Modules/WebGPU/GPUTexture.cpp:
(WebCore::GPUTexture::label const):
(WebCore::GPUTexture::setLabel):
(WebCore::convertToBacking):
(WebCore::GPUTexture::createView const):
* Modules/WebGPU/GPUTexture.h:
(WebCore::GPUTexture::create):
(WebCore::GPUTexture::backing):
(WebCore::GPUTexture::backing const):
(WebCore::GPUTexture::GPUTexture):
* Modules/WebGPU/GPUTextureAspect.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUTextureBindingLayout.h:
(WebCore::GPUTextureBindingLayout::convertToBacking const):
* Modules/WebGPU/GPUTextureDescriptor.h:
(WebCore::GPUTextureDescriptor::convertToBacking const):
* Modules/WebGPU/GPUTextureDimension.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUTextureFormat.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUTextureSampleType.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUTextureUsage.h:
(WebCore::convertTextureUsageFlagsToBacking):
* Modules/WebGPU/GPUTextureView.cpp:
(WebCore::GPUTextureView::label const):
(WebCore::GPUTextureView::setLabel):
* Modules/WebGPU/GPUTextureView.h:
(WebCore::GPUTextureView::create):
(WebCore::GPUTextureView::backing):
(WebCore::GPUTextureView::backing const):
(WebCore::GPUTextureView::GPUTextureView):
* Modules/WebGPU/GPUTextureViewDescriptor.h:
(WebCore::GPUTextureViewDescriptor::convertToBacking const):
* Modules/WebGPU/GPUTextureViewDimension.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUUncapturedErrorEvent.cpp:
(WebCore::GPUUncapturedErrorEvent::error const):
(WebCore::GPUUncapturedErrorEvent::GPUUncapturedErrorEvent): Deleted.
* Modules/WebGPU/GPUUncapturedErrorEvent.h:
(WebCore::GPUUncapturedErrorEvent::create):
(WebCore::GPUUncapturedErrorEvent::backing):
(WebCore::GPUUncapturedErrorEvent::backing const):
(WebCore::GPUUncapturedErrorEvent::GPUUncapturedErrorEvent):
* Modules/WebGPU/GPUUncapturedErrorEventInit.h:
* Modules/WebGPU/GPUValidationError.cpp:
(WebCore::GPUValidationError::message const):
(WebCore::GPUValidationError::GPUValidationError): Deleted.
* Modules/WebGPU/GPUValidationError.h:
(WebCore::GPUValidationError::create):
(WebCore::GPUValidationError::backing):
(WebCore::GPUValidationError::backing const):
(WebCore::GPUValidationError::GPUValidationError):
* Modules/WebGPU/GPUVertexAttribute.h:
(WebCore::GPUVertexAttribute::convertToBacking const):
* Modules/WebGPU/GPUVertexBufferLayout.h:
(WebCore::GPUVertexBufferLayout::convertToBacking const):
* Modules/WebGPU/GPUVertexFormat.h:
(WebCore::convertToBacking):
* Modules/WebGPU/GPUVertexState.h:
(WebCore::GPUVertexState::convertToBacking const):
* Modules/WebGPU/GPUVertexStepMode.h:
(WebCore::convertToBacking):
* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::NavigatorBase):
* page/NavigatorBase.h:
(WebCore::NavigatorBase::gpu):

Source/WebCore/PAL:

Various assorted cleanups.

* PAL.xcodeproj/project.pbxproj:
* pal/graphics/WebGPU/WebGPU.h:
* pal/graphics/WebGPU/WebGPUAdapter.h:
(PAL::WebGPU::Adapter::Adapter):
* pal/graphics/WebGPU/WebGPUBindGroupDescriptor.h:
* pal/graphics/WebGPU/WebGPUBindGroupEntry.h:
* pal/graphics/WebGPU/WebGPUBuffer.h:
* pal/graphics/WebGPU/WebGPUBufferBinding.h:
* pal/graphics/WebGPU/WebGPUCanvasConfiguration.h:
* pal/graphics/WebGPU/WebGPUColor.h: Renamed from Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUColorDict.h.
* pal/graphics/WebGPU/WebGPUCommandEncoder.h:
* pal/graphics/WebGPU/WebGPUComputePassDescriptor.h:
* pal/graphics/WebGPU/WebGPUComputePassEncoder.h:
* pal/graphics/WebGPU/WebGPUComputePassTimestampWrites.h: Renamed from Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUComputePassTimestampWrite.h.
* pal/graphics/WebGPU/WebGPUDevice.h:
(PAL::WebGPU::Device::features):
(PAL::WebGPU::Device::limits):
* pal/graphics/WebGPU/WebGPUDeviceDescriptor.h:
* pal/graphics/WebGPU/WebGPUError.h:
* pal/graphics/WebGPU/WebGPUExtent3D.h: Renamed from Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUExtent3DDict.h.
* pal/graphics/WebGPU/WebGPUExternalTextureDescriptor.h:
* pal/graphics/WebGPU/WebGPUFrontFace.h:
* pal/graphics/WebGPU/WebGPUImageCopyBuffer.h:
* pal/graphics/WebGPU/WebGPUImageCopyExternalImage.h:
* pal/graphics/WebGPU/WebGPUImageCopyTexture.h:
* pal/graphics/WebGPU/WebGPUOrigin2D.h: Renamed from Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUOrigin2DDict.h.
* pal/graphics/WebGPU/WebGPUOrigin3D.h: Renamed from Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUOrigin3DDict.h.
* pal/graphics/WebGPU/WebGPUPipelineDescriptorBase.h:
* pal/graphics/WebGPU/WebGPUPipelineLayoutDescriptor.h:
* pal/graphics/WebGPU/WebGPUProgrammableStage.h:
* pal/graphics/WebGPU/WebGPUQuerySetDescriptor.h:
* pal/graphics/WebGPU/WebGPUQueue.h:
* pal/graphics/WebGPU/WebGPURenderBundleEncoder.h:
* pal/graphics/WebGPU/WebGPURenderPassColorAttachment.h:
* pal/graphics/WebGPU/WebGPURenderPassDepthStencilAttachment.h:
* pal/graphics/WebGPU/WebGPURenderPassDescriptor.h:
* pal/graphics/WebGPU/WebGPURenderPassEncoder.h:
* pal/graphics/WebGPU/WebGPURenderPassTimestampWrites.h: Renamed from Source/WebCore/PAL/pal/graphics/WebGPU/WebGPURenderPassTimestampWrite.h.
* pal/graphics/WebGPU/WebGPUShaderModule.h:
* pal/graphics/WebGPU/WebGPUSupportedFeatures.h:
* pal/graphics/WebGPU/WebGPUSupportedLimits.h:
* pal/graphics/WebGPU/WebGPUTextureDescriptor.h:



Canonical link: https://commits.webkit.org/243985@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285429 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
litherum committed Nov 8, 2021
1 parent d354a8d commit 61ef1f111bca4d69108f031cd15c6e379aed6e3d
Showing 199 changed files with 3,623 additions and 515 deletions.

Large diffs are not rendered by default.

@@ -26,11 +26,25 @@
#include "config.h"
#include "GPU.h"

#include "JSGPUAdapter.h"

namespace WebCore {

void GPU::requestAdapter(const std::optional<GPURequestAdapterOptions>&, RequestAdapterPromise&&)
static PAL::WebGPU::RequestAdapterOptions convertToBacking(const std::optional<GPURequestAdapterOptions>& options)
{
if (!options)
return { std::nullopt, false };

return options->convertToBacking();
}

void GPU::requestAdapter(const std::optional<GPURequestAdapterOptions>& options, RequestAdapterPromise&& promise)
{
m_backing->requestAdapter(convertToBacking(options), [promise = WTFMove(promise)] (RefPtr<PAL::WebGPU::Adapter>&& adapter) mutable {
if (!adapter)
promise.resolve(nullptr);
promise.resolve(GPUAdapter::create(adapter.releaseNonNull()).ptr());
});
}

}
@@ -29,23 +29,32 @@
#include "GPURequestAdapterOptions.h"
#include "JSDOMPromiseDeferred.h"
#include <optional>
#include <pal/graphics/WebGPU/WebGPU.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>

namespace WebCore {

class GPU : public RefCounted<GPU> {
public:
static Ref<GPU> create()
static Ref<GPU> create(Ref<PAL::WebGPU::GPU>&& backing)
{
return adoptRef(*new GPU());
return adoptRef(*new GPU(WTFMove(backing)));
}

using RequestAdapterPromise = DOMPromiseDeferred<IDLNullable<IDLInterface<GPUAdapter>>>;
void requestAdapter(const std::optional<GPURequestAdapterOptions>&, RequestAdapterPromise&&);

PAL::WebGPU::GPU& backing() { return m_backing; }
const PAL::WebGPU::GPU& backing() const { return m_backing; }

private:
GPU() = default;
GPU(Ref<PAL::WebGPU::GPU>&& backing)
: m_backing(WTFMove(backing))
{
}

Ref<PAL::WebGPU::GPU> m_backing;
};

}
@@ -26,30 +26,43 @@
#include "config.h"
#include "GPUAdapter.h"

#include "JSGPUDevice.h"

namespace WebCore {

String GPUAdapter::name() const
{
return StringImpl::empty();
return m_backing->name();
}

Ref<GPUSupportedFeatures> GPUAdapter::features() const
{
return GPUSupportedFeatures::create();
return GPUSupportedFeatures::create(PAL::WebGPU::SupportedFeatures::clone(m_backing->features()));
}

Ref<GPUSupportedLimits> GPUAdapter::limits() const
{
return GPUSupportedLimits::create();
return GPUSupportedLimits::create(PAL::WebGPU::SupportedLimits::clone(m_backing->limits()));
}

bool GPUAdapter::isFallbackAdapter() const
{
return false;
return m_backing->isFallbackAdapter();
}

static PAL::WebGPU::DeviceDescriptor convertToBacking(const std::optional<GPUDeviceDescriptor>& options)
{
if (!options)
return { };

return options->convertToBacking();
}

void GPUAdapter::requestDevice(ScriptExecutionContext&, const std::optional<GPUDeviceDescriptor>&, RequestDevicePromise&&)
void GPUAdapter::requestDevice(ScriptExecutionContext&, const std::optional<GPUDeviceDescriptor>& deviceDescriptor, RequestDevicePromise&& promise)
{
m_backing->requestDevice(convertToBacking(deviceDescriptor), [promise = WTFMove(promise)] (Ref<PAL::WebGPU::Device>&& device) mutable {
promise.resolve(GPUDevice::create(nullptr, WTFMove(device)));
});
}

}
@@ -32,6 +32,7 @@
#include "JSDOMPromiseDeferred.h"
#include "ScriptExecutionContext.h"
#include <optional>
#include <pal/graphics/WebGPU/WebGPUAdapter.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -40,9 +41,9 @@ namespace WebCore {

class GPUAdapter : public RefCounted<GPUAdapter> {
public:
static Ref<GPUAdapter> create()
static Ref<GPUAdapter> create(Ref<PAL::WebGPU::Adapter>&& backing)
{
return adoptRef(*new GPUAdapter());
return adoptRef(*new GPUAdapter(WTFMove(backing)));
}

String name() const;
@@ -53,8 +54,16 @@ class GPUAdapter : public RefCounted<GPUAdapter> {
using RequestDevicePromise = DOMPromiseDeferred<IDLInterface<GPUDevice>>;
void requestDevice(ScriptExecutionContext&, const std::optional<GPUDeviceDescriptor>&, RequestDevicePromise&&);

PAL::WebGPU::Adapter& backing() { return m_backing; }
const PAL::WebGPU::Adapter& backing() const { return m_backing; }

private:
GPUAdapter() = default;
GPUAdapter(Ref<PAL::WebGPU::Adapter>&& backing)
: m_backing(WTFMove(backing))
{
}

Ref<PAL::WebGPU::Adapter> m_backing;
};

}
@@ -26,6 +26,7 @@
#pragma once

#include <cstdint>
#include <pal/graphics/WebGPU/WebGPUAddressMode.h>

namespace WebCore {

@@ -35,4 +36,17 @@ enum class GPUAddressMode : uint8_t {
MirrorRepeat
};

inline PAL::WebGPU::AddressMode convertToBacking(GPUAddressMode addressMode)
{
switch (addressMode) {
case GPUAddressMode::ClampToEdge:
return PAL::WebGPU::AddressMode::ClampToEdge;
case GPUAddressMode::Repeat:
return PAL::WebGPU::AddressMode::Repeat;
case GPUAddressMode::MirrorRepeat:
return PAL::WebGPU::AddressMode::MirrorRepeat;
}
RELEASE_ASSERT_NOT_REACHED();
}

}
@@ -30,11 +30,12 @@ namespace WebCore {

String GPUBindGroup::label() const
{
return StringImpl::empty();
return m_backing->label();
}

void GPUBindGroup::setLabel(String&&)
void GPUBindGroup::setLabel(String&& label)
{
m_backing->setLabel(WTFMove(label));
}

}
@@ -25,6 +25,7 @@

#pragma once

#include <pal/graphics/WebGPU/WebGPUBindGroup.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -33,16 +34,24 @@ namespace WebCore {

class GPUBindGroup : public RefCounted<GPUBindGroup> {
public:
static Ref<GPUBindGroup> create()
static Ref<GPUBindGroup> create(Ref<PAL::WebGPU::BindGroup>&& backing)
{
return adoptRef(*new GPUBindGroup());
return adoptRef(*new GPUBindGroup(WTFMove(backing)));
}

String label() const;
void setLabel(String&&);

PAL::WebGPU::BindGroup& backing() { return m_backing; }
const PAL::WebGPU::BindGroup& backing() const { return m_backing; }

private:
GPUBindGroup() = default;
GPUBindGroup(Ref<PAL::WebGPU::BindGroup>&& backing)
: m_backing(WTFMove(backing))
{
}

Ref<PAL::WebGPU::BindGroup> m_backing;
};

}
@@ -28,12 +28,29 @@
#include "GPUBindGroupEntry.h"
#include "GPUBindGroupLayout.h"
#include "GPUObjectDescriptorBase.h"
#include <pal/graphics/WebGPU/WebGPUBindGroupDescriptor.h>
#include <wtf/Vector.h>

namespace WebCore {

struct GPUBindGroupDescriptor : public GPUObjectDescriptorBase {
RefPtr<GPUBindGroupLayout> layout;
PAL::WebGPU::BindGroupDescriptor convertToBacking() const
{
ASSERT(layout);
return {
{ label },
layout->backing(),
([this] () {
Vector<PAL::WebGPU::BindGroupEntry> entries;
entries.reserveInitialCapacity(this->entries.size());
for (auto& bindGroupEntry : this->entries)
entries.uncheckedAppend(bindGroupEntry.convertToBacking());
return entries;
})(),
};
}

GPUBindGroupLayout* layout;
Vector<GPUBindGroupEntry> entries;
};

@@ -30,14 +30,39 @@
#include "GPUIntegralTypes.h"
#include "GPUSampler.h"
#include "GPUTextureView.h"
#include <pal/graphics/WebGPU/WebGPUBindGroupEntry.h>
#include <utility>
#include <variant>

namespace WebCore {

using GPUBindingResource = std::variant<RefPtr<GPUSampler>, RefPtr<GPUTextureView>, GPUBufferBinding, RefPtr<GPUExternalTexture>>;

inline PAL::WebGPU::BindingResource convertToBacking(const GPUBindingResource& bindingResource)
{
return WTF::switchOn(bindingResource, [] (const RefPtr<GPUSampler>& sampler) -> PAL::WebGPU::BindingResource {
ASSERT(sampler);
return sampler->backing();
}, [] (const RefPtr<GPUTextureView>& textureView) -> PAL::WebGPU::BindingResource {
ASSERT(textureView);
return textureView->backing();
}, [] (const GPUBufferBinding& bufferBinding) -> PAL::WebGPU::BindingResource {
return bufferBinding.convertToBacking();
}, [] (const RefPtr<GPUExternalTexture>& externalTexture) -> PAL::WebGPU::BindingResource {
ASSERT(externalTexture);
return externalTexture->backing();
});
}

struct GPUBindGroupEntry {
PAL::WebGPU::BindGroupEntry convertToBacking() const
{
return {
binding,
WebCore::convertToBacking(resource),
};
}

GPUIndex32 binding;
GPUBindingResource resource;
};
@@ -30,11 +30,12 @@ namespace WebCore {

String GPUBindGroupLayout::label() const
{
return StringImpl::empty();
return m_backing->label();
}

void GPUBindGroupLayout::setLabel(String&&)
void GPUBindGroupLayout::setLabel(String&& label)
{
m_backing->setLabel(WTFMove(label));
}

}
@@ -25,6 +25,7 @@

#pragma once

#include <pal/graphics/WebGPU/WebGPUBindGroupLayout.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -33,16 +34,24 @@ namespace WebCore {

class GPUBindGroupLayout : public RefCounted<GPUBindGroupLayout> {
public:
static Ref<GPUBindGroupLayout> create()
static Ref<GPUBindGroupLayout> create(Ref<PAL::WebGPU::BindGroupLayout>&& backing)
{
return adoptRef(*new GPUBindGroupLayout());
return adoptRef(*new GPUBindGroupLayout(WTFMove(backing)));
}

String label() const;
void setLabel(String&&);

PAL::WebGPU::BindGroupLayout& backing() { return m_backing; }
const PAL::WebGPU::BindGroupLayout& backing() const { return m_backing; }

private:
GPUBindGroupLayout() = default;
GPUBindGroupLayout(Ref<PAL::WebGPU::BindGroupLayout>&& backing)
: m_backing(WTFMove(backing))
{
}

Ref<PAL::WebGPU::BindGroupLayout> m_backing;
};

}
@@ -27,11 +27,26 @@

#include "GPUBindGroupLayoutEntry.h"
#include "GPUObjectDescriptorBase.h"
#include <pal/graphics/WebGPU/WebGPUBindGroupLayoutDescriptor.h>
#include <wtf/Vector.h>

namespace WebCore {

struct GPUBindGroupLayoutDescriptor : public GPUObjectDescriptorBase {
PAL::WebGPU::BindGroupLayoutDescriptor convertToBacking() const
{
return {
{ label },
([this] () {
Vector<PAL::WebGPU::BindGroupLayoutEntry> entries;
entries.reserveInitialCapacity(this->entries.size());
for (auto& entry : this->entries)
entries.uncheckedAppend(entry.convertToBacking());
return entries;
})(),
};