/* -*- 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