webgpu: Implement proper async pipeline creation and GPUPipelineError (#32636)

* Add GPUPipelineError

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Proper GetBindGroupLayout

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Proper Create*PipelineAsync

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* fixups

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* more good expectations

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:
Samson 2024-08-08 13:48:43 +02:00 committed by GitHub
parent 08eb4faf4d
commit b8cf0cf9af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 465 additions and 790 deletions

View file

@ -103,6 +103,8 @@ pub enum WebGPURequest {
compute_pipeline_id: id::ComputePipelineId,
descriptor: ComputePipelineDescriptor<'static>,
implicit_ids: Option<(id::PipelineLayoutId, Vec<id::BindGroupLayoutId>)>,
/// present only on ASYNC versions
async_sender: Option<IpcSender<WebGPUResponse>>,
},
CreateContext(IpcSender<ExternalImageId>),
CreatePipelineLayout {
@ -113,8 +115,10 @@ pub enum WebGPURequest {
CreateRenderPipeline {
device_id: id::DeviceId,
render_pipeline_id: id::RenderPipelineId,
descriptor: Option<RenderPipelineDescriptor<'static>>,
descriptor: RenderPipelineDescriptor<'static>,
implicit_ids: Option<(id::PipelineLayoutId, Vec<id::BindGroupLayoutId>)>,
/// present only on ASYNC versions
async_sender: Option<IpcSender<WebGPUResponse>>,
},
CreateSampler {
device_id: id::DeviceId,
@ -301,4 +305,16 @@ pub enum WebGPURequest {
device_id: id::DeviceId,
sender: IpcSender<WebGPUResponse>,
},
ComputeGetBindGroupLayout {
device_id: id::DeviceId,
pipeline_id: id::ComputePipelineId,
index: u32,
id: id::BindGroupLayoutId,
},
RenderGetBindGroupLayout {
device_id: id::DeviceId,
pipeline_id: id::RenderPipelineId,
index: u32,
id: id::BindGroupLayoutId,
},
}

View file

@ -6,6 +6,7 @@
use ipc_channel::ipc::IpcSharedMemory;
use serde::{Deserialize, Serialize};
use wgc::id;
use wgc::pipeline::CreateShaderModuleError;
use wgpu_core::instance::{RequestAdapterError, RequestDeviceError};
use wgpu_core::resource::BufferAccessError;
@ -65,6 +66,12 @@ pub struct Adapter {
pub channel: WebGPU,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct Pipeline<T: std::fmt::Debug + Serialize> {
pub id: T,
pub label: String,
}
#[derive(Debug, Deserialize, Serialize)]
#[allow(clippy::large_enum_variant)]
pub enum WebGPUResponse {
@ -82,4 +89,6 @@ pub enum WebGPUResponse {
SubmittedWorkDone,
PoppedErrorScope(Result<Option<Error>, PopError>),
CompilationInfo(Option<ShaderCompilationInfo>),
RenderPipeline(Result<Pipeline<id::RenderPipelineId>, Error>),
ComputePipeline(Result<Pipeline<id::ComputePipelineId>, Error>),
}