diff options
Diffstat (limited to 'dom/webgpu/ipc/PWebGPU.ipdl')
-rw-r--r-- | dom/webgpu/ipc/PWebGPU.ipdl | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/dom/webgpu/ipc/PWebGPU.ipdl b/dom/webgpu/ipc/PWebGPU.ipdl new file mode 100644 index 0000000000..3bdc49fa4d --- /dev/null +++ b/dom/webgpu/ipc/PWebGPU.ipdl @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * vim: sw=2 ts=8 et : + */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +using mozilla::layers::RGBDescriptor from "mozilla/layers/LayersSurfaces.h"; +using mozilla::layers::RemoteTextureId from "mozilla/layers/LayersTypes.h"; +using mozilla::layers::RemoteTextureOwnerId from "mozilla/layers/LayersTypes.h"; +using mozilla::webgpu::RawId from "mozilla/webgpu/WebGPUTypes.h"; +using mozilla::dom::GPURequestAdapterOptions from "mozilla/dom/WebGPUBinding.h"; +using mozilla::dom::GPUCommandBufferDescriptor from "mozilla/dom/WebGPUBinding.h"; +using mozilla::dom::GPUBufferDescriptor from "mozilla/dom/WebGPUBinding.h"; +using mozilla::webgpu::MaybeScopedError from "mozilla/webgpu/WebGPUTypes.h"; +using mozilla::webgpu::WebGPUCompilationMessage from "mozilla/webgpu/WebGPUTypes.h"; +[MoveOnly] using class mozilla::ipc::UnsafeSharedMemoryHandle from "mozilla/ipc/RawShmem.h"; + +include "mozilla/ipc/ByteBufUtils.h"; +include "mozilla/layers/LayersMessageUtils.h"; +include "mozilla/webgpu/WebGPUSerialize.h"; +include "mozilla/layers/WebRenderMessageUtils.h"; +include protocol PCanvasManager; +include PWebGPUTypes; + +namespace mozilla { +namespace webgpu { + +/** + * Represents the connection between a WebGPUChild actor that issues WebGPU + * command from the content process, and a WebGPUParent in the compositor + * process that runs the commands. + */ +async protocol PWebGPU +{ + manager PCanvasManager; + +parent: + async DeviceAction(RawId selfId, ByteBuf buf); + async DeviceActionWithAck(RawId selfId, ByteBuf buf) returns (bool dummy); + async TextureAction(RawId selfId, RawId aDeviceId, ByteBuf buf); + async CommandEncoderAction(RawId selfId, RawId aDeviceId, ByteBuf buf); + async BumpImplicitBindGroupLayout(RawId pipelineId, bool isCompute, uint32_t index, RawId assignId); + + async CreateBuffer(RawId deviceId, RawId bufferId, GPUBufferDescriptor desc, UnsafeSharedMemoryHandle shm); + + async InstanceRequestAdapter(GPURequestAdapterOptions options, RawId[] ids) returns (ByteBuf byteBuf); + async AdapterRequestDevice(RawId selfId, ByteBuf buf, RawId newId) returns (bool success); + async AdapterDestroy(RawId selfId); + // TODO: We want to return an array of compilation messages. + async DeviceCreateShaderModule(RawId selfId, RawId bufferId, nsString label, nsCString code) returns (WebGPUCompilationMessage[] messages); + async BufferMap(RawId selfId, uint32_t aMode, uint64_t offset, uint64_t size) returns (BufferMapResult result); + async BufferUnmap(RawId deviceId, RawId bufferId, bool flush); + async BufferDestroy(RawId selfId); + async BufferDrop(RawId selfId); + async TextureDestroy(RawId selfId); + async TextureViewDestroy(RawId selfId); + async SamplerDestroy(RawId selfId); + async DeviceDestroy(RawId selfId); + + async CommandEncoderFinish(RawId selfId, RawId deviceId, GPUCommandBufferDescriptor desc); + async CommandEncoderDestroy(RawId selfId); + async CommandBufferDestroy(RawId selfId); + async RenderBundleDestroy(RawId selfId); + async QueueSubmit(RawId selfId, RawId aDeviceId, RawId[] commandBuffers); + async QueueWriteAction(RawId selfId, RawId aDeviceId, ByteBuf buf, UnsafeSharedMemoryHandle shmem); + + async BindGroupLayoutDestroy(RawId selfId); + async PipelineLayoutDestroy(RawId selfId); + async BindGroupDestroy(RawId selfId); + async ShaderModuleDestroy(RawId selfId); + async ComputePipelineDestroy(RawId selfId); + async RenderPipelineDestroy(RawId selfId); + async ImplicitLayoutDestroy(RawId implicitPlId, RawId[] implicitBglIds); + async DeviceCreateSwapChain(RawId selfId, RawId queueId, RGBDescriptor desc, RawId[] bufferIds, RemoteTextureOwnerId ownerId); + async SwapChainPresent(RawId textureId, RawId commandEncoderId, RemoteTextureId remoteTextureId, RemoteTextureOwnerId remoteTextureOwnerId); + async SwapChainDestroy(RemoteTextureOwnerId ownerId); + + async DevicePushErrorScope(RawId selfId); + async DevicePopErrorScope(RawId selfId) returns (MaybeScopedError maybeError); + + // Generate an error on the Device timeline for `deviceId`. + // The `message` parameter is interpreted as UTF-8. + async GenerateError(RawId deviceId, nsCString message); + +child: + async DeviceUncapturedError(RawId aDeviceId, nsCString message); + async DropAction(ByteBuf buf); + async __delete__(); +}; + +} // webgpu +} // mozilla |