mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 07:51:08 +01:00
[wgpu-core] use Fallible for ComputePipeline
This commit is contained in:
1 parent
b42500ee40
commit
82ce2ea747
6 files changed
+21
-19
No files matched your search
@@ -134,8 +134,6 @@ pub enum ComputePassErrorInner {
|
||||
InvalidParentEncoder,
|
||||
#[error("Bind group index {index} is greater than the device's requested `max_bind_group` limit {max}")]
|
||||
BindGroupIndexOutOfRange { index: u32, max: u32 },
|
||||
#[error("ComputePipelineId {0:?} is invalid")]
|
||||
InvalidPipelineId(id::ComputePipelineId),
|
||||
#[error(transparent)]
|
||||
DestroyedResource(#[from] DestroyedResourceError),
|
||||
#[error("Indirect buffer uses bytes {offset}..{end_offset} which overruns indirect buffer of size {buffer_size}")]
|
||||
@@ -1016,8 +1014,8 @@ impl Global {
|
||||
let hub = &self.hub;
|
||||
let pipeline = hub
|
||||
.compute_pipelines
|
||||
.get(pipeline_id)
|
||||
.map_err(|_| ComputePassErrorInner::InvalidPipelineId(pipeline_id))
|
||||
.strict_get(pipeline_id)
|
||||
.get()
|
||||
.map_pass_err(scope)?;
|
||||
|
||||
base.commands.push(ArcComputeCommand::SetPipeline(pipeline));
|
||||
|
||||
@@ -74,7 +74,7 @@ impl ComputeCommand {
|
||||
hub: &crate::hub::Hub,
|
||||
commands: &[ComputeCommand],
|
||||
) -> Result<Vec<ArcComputeCommand>, super::ComputePassError> {
|
||||
use super::{ComputePassError, ComputePassErrorInner, PassErrorScope};
|
||||
use super::{ComputePassError, PassErrorScope};
|
||||
|
||||
let buffers_guard = hub.buffers.read();
|
||||
let bind_group_guard = hub.bind_groups.read();
|
||||
@@ -114,12 +114,12 @@ impl ComputeCommand {
|
||||
}
|
||||
}
|
||||
ComputeCommand::SetPipeline(pipeline_id) => ArcComputeCommand::SetPipeline(
|
||||
pipelines_guard
|
||||
.get_owned(pipeline_id)
|
||||
.map_err(|_| ComputePassError {
|
||||
pipelines_guard.strict_get(pipeline_id).get().map_err(|e| {
|
||||
ComputePassError {
|
||||
scope: PassErrorScope::SetPipelineCompute,
|
||||
inner: ComputePassErrorInner::InvalidPipelineId(pipeline_id),
|
||||
})?,
|
||||
inner: e.into(),
|
||||
}
|
||||
})?,
|
||||
),
|
||||
|
||||
ComputeCommand::SetPushConstant {
|
||||
|
||||
Reference in new issue
Block a user