mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
webgpu: Divide message code into separate files (#32700)
* Spilt webgpu ipc messages even more * Add license to mod.rs * file docs
This commit is contained in:
parent
40bac8c3df
commit
91ca727eb9
5 changed files with 93 additions and 73 deletions
62
components/webgpu/ipc_messages/to_script.rs
Normal file
62
components/webgpu/ipc_messages/to_script.rs
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* 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 https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! IPC messages that are send to script thread.
|
||||
|
||||
use base::id::PipelineId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::gpu_error::Error;
|
||||
use crate::identity::WebGPUDevice;
|
||||
use crate::wgc::id::{
|
||||
AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandBufferId, ComputePassEncoderId,
|
||||
ComputePipelineId, DeviceId, PipelineLayoutId, QuerySetId, RenderBundleId, RenderPassEncoderId,
|
||||
RenderPipelineId, SamplerId, ShaderModuleId, StagingBufferId, SurfaceId, TextureId,
|
||||
TextureViewId,
|
||||
};
|
||||
|
||||
/// <https://gpuweb.github.io/gpuweb/#enumdef-gpudevicelostreason>
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
pub enum DeviceLostReason {
|
||||
Unknown,
|
||||
Destroyed,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum WebGPUMsg {
|
||||
FreeAdapter(AdapterId),
|
||||
FreeDevice {
|
||||
device_id: DeviceId,
|
||||
pipeline_id: PipelineId,
|
||||
},
|
||||
FreeBuffer(BufferId),
|
||||
FreePipelineLayout(PipelineLayoutId),
|
||||
FreeComputePipeline(ComputePipelineId),
|
||||
FreeRenderPipeline(RenderPipelineId),
|
||||
FreeBindGroup(BindGroupId),
|
||||
FreeBindGroupLayout(BindGroupLayoutId),
|
||||
FreeCommandBuffer(CommandBufferId),
|
||||
FreeTexture(TextureId),
|
||||
FreeTextureView(TextureViewId),
|
||||
FreeSampler(SamplerId),
|
||||
FreeSurface(SurfaceId),
|
||||
FreeShaderModule(ShaderModuleId),
|
||||
FreeRenderBundle(RenderBundleId),
|
||||
FreeStagingBuffer(StagingBufferId),
|
||||
FreeQuerySet(QuerySetId),
|
||||
FreeComputePass(ComputePassEncoderId),
|
||||
FreeRenderPass(RenderPassEncoderId),
|
||||
UncapturedError {
|
||||
device: WebGPUDevice,
|
||||
pipeline_id: PipelineId,
|
||||
error: Error,
|
||||
},
|
||||
DeviceLost {
|
||||
device: WebGPUDevice,
|
||||
pipeline_id: PipelineId,
|
||||
reason: DeviceLostReason,
|
||||
msg: String,
|
||||
},
|
||||
Exit,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue