Merge PassErrorScope::Draw* and Dispatch* variants

This commit is contained in:
Mikko Lehtonen committed 2021-01-12 22:23:17 +02:00
1 parent 0d60bd80c5
commit 6c56613045
4 files changed
+57 -28

No files matched your search

+20 -4
View File
@@ -312,7 +312,11 @@ impl RenderBundleEncoder {
first_vertex,
first_instance,
} => {
let scope = PassErrorScope::Draw(state.pipeline.last_state);
let scope = PassErrorScope::Draw {
indexed: false,
indirect: false,
pipeline: state.pipeline.last_state,
};
let vertex_limits = state.vertex_limits();
let last_vertex = first_vertex + vertex_count;
if last_vertex > vertex_limits.vertex_limit {
@@ -343,7 +347,11 @@ impl RenderBundleEncoder {
base_vertex: _,
first_instance,
} => {
let scope = PassErrorScope::DrawIndexed(state.pipeline.last_state);
let scope = PassErrorScope::Draw {
indexed: true,
indirect: false,
pipeline: state.pipeline.last_state,
};
//TODO: validate that base_vertex + max_index() is within the provided range
let vertex_limits = state.vertex_limits();
let index_limit = state.index.limit();
@@ -375,7 +383,11 @@ impl RenderBundleEncoder {
count: None,
indexed: false,
} => {
let scope = PassErrorScope::DrawIndirect(state.pipeline.last_state);
let scope = PassErrorScope::Draw {
indexed: false,
indirect: true,
pipeline: state.pipeline.last_state,
};
let buffer = state
.trackers
.buffers
@@ -394,7 +406,11 @@ impl RenderBundleEncoder {
count: None,
indexed: true,
} => {
let scope = PassErrorScope::DrawIndexedIndirect(state.pipeline.last_state);
let scope = PassErrorScope::Draw {
indexed: true,
indirect: true,
pipeline: state.pipeline.last_state,
};
let buffer = state
.trackers
.buffers
+8 -2
View File
@@ -442,7 +442,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
unsafe { raw.push_compute_constants(&pipeline_layout.raw, offset, data_slice) }
}
ComputeCommand::Dispatch(groups) => {
let scope = PassErrorScope::Dispatch(state.pipeline.last_state);
let scope = PassErrorScope::Dispatch {
indirect: false,
pipeline: state.pipeline.last_state,
};
state.is_ready().map_pass_err(scope)?;
state
@@ -459,7 +462,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
}
ComputeCommand::DispatchIndirect { buffer_id, offset } => {
let scope = PassErrorScope::DispatchIndirect(state.pipeline.last_state);
let scope = PassErrorScope::Dispatch {
indirect: true,
pipeline: state.pipeline.last_state,
};
state.is_ready().map_pass_err(scope)?;
+11 -12
View File
@@ -361,20 +361,19 @@ pub enum PassErrorScope {
SetViewport,
#[error("In a set_scissor_rect command")]
SetScissorRect,
#[error("In a draw command")]
Draw(Option<id::RenderPipelineId>),
#[error("In a draw_indexed command")]
DrawIndexed(Option<id::RenderPipelineId>),
#[error("In a draw_indirect command")]
DrawIndirect(Option<id::RenderPipelineId>),
#[error("In a draw_indexed_indirect command")]
DrawIndexedIndirect(Option<id::RenderPipelineId>),
#[error("In a draw command, indexed:{indexed} indirect:{indirect}")]
Draw {
indexed: bool,
indirect: bool,
pipeline: Option<id::RenderPipelineId>,
},
#[error("In a execute_bundle command")]
ExecuteBundle,
#[error("In a dispatch command")]
Dispatch(Option<id::ComputePipelineId>),
#[error("In a dispatch_indirect command")]
DispatchIndirect(Option<id::ComputePipelineId>),
#[error("In a dispatch command, indirect:{indirect}")]
Dispatch {
indirect: bool,
pipeline: Option<id::ComputePipelineId>,
},
#[error("In a pop_debug_group command")]
PopDebugGroup,
}
+18 -10
View File
@@ -1543,7 +1543,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
first_vertex,
first_instance,
} => {
let scope = PassErrorScope::Draw(state.pipeline.last_state);
let scope = PassErrorScope::Draw {
indexed: false,
indirect: false,
pipeline: state.pipeline.last_state,
};
state.is_ready().map_pass_err(scope)?;
let last_vertex = first_vertex + vertex_count;
let vertex_limit = state.vertex.vertex_limit;
@@ -1580,7 +1584,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
base_vertex,
first_instance,
} => {
let scope = PassErrorScope::DrawIndexed(state.pipeline.last_state);
let scope = PassErrorScope::Draw {
indexed: true,
indirect: false,
pipeline: state.pipeline.last_state,
};
state.is_ready().map_pass_err(scope)?;
//TODO: validate that base_vertex + max_index() is within the provided range
@@ -1618,10 +1626,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
count,
indexed,
} => {
let scope = if indexed {
PassErrorScope::DrawIndexedIndirect(state.pipeline.last_state)
} else {
PassErrorScope::DrawIndirect(state.pipeline.last_state)
let scope = PassErrorScope::Draw {
indexed,
indirect: true,
pipeline: state.pipeline.last_state,
};
state.is_ready().map_pass_err(scope)?;
@@ -1694,10 +1702,10 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
max_count,
indexed,
} => {
let scope = if indexed {
PassErrorScope::DrawIndexedIndirect(state.pipeline.last_state)
} else {
PassErrorScope::DrawIndirect(state.pipeline.last_state)
let scope = PassErrorScope::Draw {
indexed,
indirect: true,
pipeline: state.pipeline.last_state,
};
state.is_ready().map_pass_err(scope)?;