webgpu_traits/messages/
to_script.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5//! IPC messages that are sent to the ScriptThread.
6
7use base::id::PipelineId;
8use serde::{Deserialize, Serialize};
9use wgpu_core::id::{
10    AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandBufferId, ComputePassEncoderId,
11    ComputePipelineId, DeviceId, PipelineLayoutId, QuerySetId, RenderBundleId, RenderPassEncoderId,
12    RenderPipelineId, SamplerId, ShaderModuleId, StagingBufferId, SurfaceId, TextureId,
13    TextureViewId,
14};
15
16use crate::{DeviceLostReason, Error, WebGPUDevice};
17
18#[derive(Clone, Debug, Deserialize, Serialize)]
19pub enum WebGPUMsg {
20    FreeAdapter(AdapterId),
21    FreeDevice {
22        device_id: DeviceId,
23        pipeline_id: PipelineId,
24    },
25    FreeBuffer(BufferId),
26    FreePipelineLayout(PipelineLayoutId),
27    FreeComputePipeline(ComputePipelineId),
28    FreeRenderPipeline(RenderPipelineId),
29    FreeBindGroup(BindGroupId),
30    FreeBindGroupLayout(BindGroupLayoutId),
31    FreeCommandBuffer(CommandBufferId),
32    FreeTexture(TextureId),
33    FreeTextureView(TextureViewId),
34    FreeSampler(SamplerId),
35    FreeSurface(SurfaceId),
36    FreeShaderModule(ShaderModuleId),
37    FreeRenderBundle(RenderBundleId),
38    FreeStagingBuffer(StagingBufferId),
39    FreeQuerySet(QuerySetId),
40    FreeComputePass(ComputePassEncoderId),
41    FreeRenderPass(RenderPassEncoderId),
42    UncapturedError {
43        device: WebGPUDevice,
44        pipeline_id: PipelineId,
45        error: Error,
46    },
47    DeviceLost {
48        device: WebGPUDevice,
49        pipeline_id: PipelineId,
50        reason: DeviceLostReason,
51        msg: String,
52    },
53    Exit,
54}