summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/ipc/PWebGPU.ipdl
blob: 451480a1c39d7a11e1dbaa86849b20b1faa33655 (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
94
95
96
97
98
99
100
101
102
/* -*- 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::layers::RemoteTextureTxnType from "mozilla/layers/LayersTypes.h";
using mozilla::layers::RemoteTextureTxnId from "mozilla/layers/LayersTypes.h";
using mozilla::webgpu::RawId from "mozilla/webgpu/WebGPUTypes.h";
using mozilla::dom::GPUErrorFilter from "mozilla/dom/WebGPUBinding.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::PopErrorScopeResult 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";
using struct mozilla::void_t from "mozilla/ipc/IPCCore.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 RenderPass(RawId selfId, RawId aDeviceId, ByteBuf buf);
  async ComputePass(RawId selfId, RawId aDeviceId, ByteBuf buf);
  async BumpImplicitBindGroupLayout(RawId pipelineId, bool isCompute, uint32_t index, RawId assignId);

  async DeviceCreateBuffer(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 AdapterDrop(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 deviceId, RawId bufferId, 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, RawId deviceId);
  async TextureDrop(RawId selfId);
  async TextureViewDrop(RawId selfId);
  async SamplerDrop(RawId selfId);
  async DeviceDestroy(RawId selfId);
  async DeviceDrop(RawId selfId);

  async CommandEncoderFinish(RawId selfId, RawId deviceId, GPUCommandBufferDescriptor desc);
  async CommandEncoderDrop(RawId selfId);
  async RenderBundleDrop(RawId selfId);
  async QueueSubmit(RawId selfId, RawId aDeviceId, RawId[] commandBuffers, RawId[] textureIds);
  async QueueOnSubmittedWorkDone(RawId selfId) returns (void_t ok);
  async QueueWriteAction(RawId selfId, RawId aDeviceId, ByteBuf buf, UnsafeSharedMemoryHandle shmem);

  async BindGroupLayoutDrop(RawId selfId);
  async PipelineLayoutDrop(RawId selfId);
  async BindGroupDrop(RawId selfId);
  async ShaderModuleDrop(RawId selfId);
  async ComputePipelineDrop(RawId selfId);
  async RenderPipelineDrop(RawId selfId);
  async ImplicitLayoutDrop(RawId implicitPlId, RawId[] implicitBglIds);
  async DeviceCreateSwapChain(RawId selfId, RawId queueId, RGBDescriptor desc, RawId[] bufferIds, RemoteTextureOwnerId ownerId, bool useExternalTextureInSwapChain);
  async SwapChainPresent(RawId textureId, RawId commandEncoderId, RemoteTextureId remoteTextureId, RemoteTextureOwnerId remoteTextureOwnerId);
  async SwapChainDrop(RemoteTextureOwnerId ownerId, RemoteTextureTxnType txnType, RemoteTextureTxnId txnId);

  async DevicePushErrorScope(RawId selfId, GPUErrorFilter aFilter);
  async DevicePopErrorScope(RawId selfId) returns (PopErrorScopeResult result);

  // Generate an error on the Device timeline for `deviceId`.
  // The `message` parameter is interpreted as UTF-8.
  async GenerateError(RawId? deviceId, GPUErrorFilter type, nsCString message);

child:
  async UncapturedError(RawId? aDeviceId, nsCString message);
  async DropAction(ByteBuf buf);
  async DeviceLost(RawId aDeviceId, uint8_t? reason, nsCString message);
  async __delete__();
};

} // webgpu
} // mozilla