1037: Add Ids to PassErrorScope r=kvark a=scoopr

Also makes it pub, and the places it is used.
Tweak some error messages.


Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
This commit is contained in:
bors[bot]andMikko Lehtonen authored and GitHub committed 2020-11-22 19:40:57 +00:00
commit feac96d315
6 files changed
+27 -25

No files matched your search

+5 -5
View File
@@ -680,7 +680,7 @@ where
#[derive(Clone, Debug, Error)]
#[error("{scope}")]
pub struct RenderBundleError {
scope: PassErrorScope,
pub scope: PassErrorScope,
#[source]
inner: RenderBundleErrorInner,
}
@@ -745,7 +745,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
num_dynamic_offsets,
bind_group_id,
} => {
let scope = PassErrorScope::SetBindGroup;
let scope = PassErrorScope::SetBindGroup(bind_group_id);
let max_bind_groups = device.limits.max_bind_groups;
if (index as u32) >= max_bind_groups {
@@ -790,7 +790,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.map_pass_err(scope)?;
}
RenderCommand::SetPipeline(pipeline_id) => {
let scope = PassErrorScope::SetPipeline;
let scope = PassErrorScope::SetPipelineRender(pipeline_id);
if state.pipeline.set_and_check_redundant(pipeline_id) {
continue;
}
@@ -828,7 +828,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
offset,
size,
} => {
let scope = PassErrorScope::SetIndexBuffer;
let scope = PassErrorScope::SetIndexBuffer(buffer_id);
let buffer = state
.trackers
.buffers
@@ -849,7 +849,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
offset,
size,
} => {
let scope = PassErrorScope::SetVertexBuffer;
let scope = PassErrorScope::SetVertexBuffer(buffer_id);
let buffer = state
.trackers
.buffers
+4 -4
View File
@@ -148,7 +148,7 @@ pub enum ComputePassErrorInner {
#[derive(Clone, Debug, Error)]
#[error("{scope}")]
pub struct ComputePassError {
scope: PassErrorScope,
pub scope: PassErrorScope,
#[source]
inner: ComputePassErrorInner,
}
@@ -234,7 +234,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
mut base: BasePassRef<ComputeCommand>,
) -> Result<(), ComputePassError> {
span!(_guard, INFO, "CommandEncoder::run_compute_pass");
let scope = PassErrorScope::Pass;
let scope = PassErrorScope::Pass(encoder_id);
let hub = B::hub(self);
let mut token = Token::root();
@@ -273,7 +273,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
num_dynamic_offsets,
bind_group_id,
} => {
let scope = PassErrorScope::SetBindGroup;
let scope = PassErrorScope::SetBindGroup(bind_group_id);
let max_bind_groups = cmd_buf.limits.max_bind_groups;
if (index as u32) >= max_bind_groups {
@@ -324,7 +324,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
}
ComputeCommand::SetPipeline(pipeline_id) => {
let scope = PassErrorScope::SetPipeline;
let scope = PassErrorScope::SetPipelineCompute(pipeline_id);
if state.pipeline.set_and_check_redundant(pipeline_id) {
continue;
+1 -1
View File
@@ -57,7 +57,7 @@ pub enum RenderCommandError {
InvalidDynamicOffsetCount { actual: usize, expected: usize },
#[error("render pipeline {0:?} is invalid")]
InvalidPipeline(id::RenderPipelineId),
#[error("render pipeline is incompatible, {0}")]
#[error("Render pipeline is incompatible with render pass")]
IncompatiblePipeline(#[from] crate::device::RenderPassCompatibilityError),
#[error("pipeline is not compatible with the depth-stencil read-only render pass")]
IncompatibleReadOnlyDepthStencil,
+8 -6
View File
@@ -315,21 +315,23 @@ trait MapPassErr<T, O> {
}
#[derive(Clone, Copy, Debug, Error)]
enum PassErrorScope {
pub enum PassErrorScope {
#[error("In a bundle parameter")]
Bundle,
#[error("In a pass parameter")]
Pass,
Pass(id::CommandEncoderId),
#[error("In a set_bind_group command")]
SetBindGroup,
SetBindGroup(id::BindGroupId),
#[error("In a set_pipeline command")]
SetPipeline,
SetPipelineRender(id::RenderPipelineId),
#[error("In a set_pipeline command")]
SetPipelineCompute(id::ComputePipelineId),
#[error("In a set_push_constant command")]
SetPushConstant,
#[error("In a set_vertex_buffer command")]
SetVertexBuffer,
SetVertexBuffer(id::BufferId),
#[error("In a set_index_buffer command")]
SetIndexBuffer,
SetIndexBuffer(id::BufferId),
#[error("In a set_viewport command")]
SetViewport,
#[error("In a set_scissor_rect command")]
+6 -6
View File
@@ -396,7 +396,7 @@ impl From<MissingTextureUsageError> for RenderPassErrorInner {
#[derive(Clone, Debug, Error)]
#[error("{scope}")]
pub struct RenderPassError {
scope: PassErrorScope,
pub scope: PassErrorScope,
#[source]
inner: RenderPassErrorInner,
}
@@ -449,7 +449,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
depth_stencil_attachment: Option<&DepthStencilAttachmentDescriptor>,
) -> Result<(), RenderPassError> {
span!(_guard, INFO, "CommandEncoder::run_render_pass");
let scope = PassErrorScope::Pass;
let scope = PassErrorScope::Pass(encoder_id);
let hub = B::hub(self);
let mut token = Token::root();
@@ -1003,7 +1003,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
num_dynamic_offsets,
bind_group_id,
} => {
let scope = PassErrorScope::SetBindGroup;
let scope = PassErrorScope::SetBindGroup(bind_group_id);
let max_bind_groups = device.limits.max_bind_groups;
if (index as u32) >= max_bind_groups {
return Err(RenderCommandError::BindGroupIndexOutOfRange {
@@ -1055,7 +1055,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
};
}
RenderCommand::SetPipeline(pipeline_id) => {
let scope = PassErrorScope::SetPipeline;
let scope = PassErrorScope::SetPipelineRender(pipeline_id);
if state.pipeline.set_and_check_redundant(pipeline_id) {
continue;
}
@@ -1197,7 +1197,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
offset,
size,
} => {
let scope = PassErrorScope::SetIndexBuffer;
let scope = PassErrorScope::SetIndexBuffer(buffer_id);
let buffer = trackers
.buffers
.use_extend(&*buffer_guard, buffer_id, (), BufferUse::INDEX)
@@ -1236,7 +1236,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
offset,
size,
} => {
let scope = PassErrorScope::SetVertexBuffer;
let scope = PassErrorScope::SetVertexBuffer(buffer_id);
let buffer = trackers
.buffers
.use_extend(&*buffer_guard, buffer_id, (), BufferUse::VERTEX)
+3 -3
View File
@@ -117,14 +117,14 @@ pub(crate) struct RenderPassContext {
}
#[derive(Clone, Debug, Error)]
pub enum RenderPassCompatibilityError {
#[error("incompatible color attachment: {0:?} != {1:?}")]
#[error("Incompatible color attachment: {0:?} != {1:?}")]
IncompatibleColorAttachment(
ArrayVec<[TextureFormat; MAX_COLOR_TARGETS]>,
ArrayVec<[TextureFormat; MAX_COLOR_TARGETS]>,
),
#[error("incompatible depth-stencil attachment: {0:?} != {1:?}")]
#[error("Incompatible depth-stencil attachment: {0:?} != {1:?}")]
IncompatibleDepthStencilAttachment(Option<TextureFormat>, Option<TextureFormat>),
#[error("incompatible sample count: {0:?} != {1:?}")]
#[error("Incompatible sample count: {0:?} != {1:?}")]
IncompatibleSampleCount(u8, u8),
}