mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Less nesting in webgpu response (#32799)
* Remove Option wrap of WebGPUResponse Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Replace WebGPUResponseResult with WebGPUResponse Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
1223335547
commit
34eed29037
11 changed files with 196 additions and 214 deletions
|
@ -54,25 +54,32 @@ impl ShaderCompilationInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Adapter {
|
||||
pub adapter_info: wgt::AdapterInfo,
|
||||
pub adapter_id: WebGPUAdapter,
|
||||
pub features: wgt::Features,
|
||||
pub limits: wgt::Limits,
|
||||
pub channel: WebGPU,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct Device {
|
||||
pub device_id: WebGPUDevice,
|
||||
pub queue_id: WebGPUQueue,
|
||||
pub descriptor: wgt::DeviceDescriptor<Option<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum WebGPUResponse {
|
||||
RequestAdapter {
|
||||
adapter_info: wgt::AdapterInfo,
|
||||
adapter_id: WebGPUAdapter,
|
||||
features: wgt::Features,
|
||||
limits: wgt::Limits,
|
||||
channel: WebGPU,
|
||||
},
|
||||
RequestDevice {
|
||||
device_id: WebGPUDevice,
|
||||
queue_id: WebGPUQueue,
|
||||
descriptor: wgt::DeviceDescriptor<Option<String>>,
|
||||
},
|
||||
BufferMapAsync(IpcSharedMemory),
|
||||
/// WebGPU is disabled
|
||||
None,
|
||||
// TODO: use wgpu errors
|
||||
Adapter(Result<Adapter, String>),
|
||||
Device(Result<Device, String>),
|
||||
BufferMapAsync(Result<IpcSharedMemory, String>),
|
||||
SubmittedWorkDone,
|
||||
PoppedErrorScope(Result<Option<Error>, PopError>),
|
||||
CompilationInfo(Option<ShaderCompilationInfo>),
|
||||
}
|
||||
|
||||
pub type WebGPUResponseResult = Result<WebGPUResponse, String>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue