summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/ipc/PWebGPU.ipdl
blob: 3bdc49fa4d5ebaf02f31344d86f4cb17024f9c23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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