Skip to content

Commit

Permalink
Merge gfx-rs#586
Browse files Browse the repository at this point in the history
586: Improve drawing error messages r=kvark a=HalfVoxel



Co-authored-by: Aron Granberg <[email protected]>
  • Loading branch information
bors[bot] and HalfVoxel authored Apr 15, 2020
2 parents 2b12001 + 41a6425 commit 6b0751f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use wgt::{
TextureUsage, BIND_BUFFER_ALIGNMENT,
};

use std::{borrow::Borrow, collections::hash_map::Entry, iter, mem, ops::Range, slice};
use std::{borrow::Borrow, collections::hash_map::Entry, fmt, iter, mem, ops::Range, slice};

pub type RenderPassColorAttachmentDescriptor =
RenderPassColorAttachmentDescriptorBase<id::TextureViewId>;
Expand Down Expand Up @@ -175,7 +175,7 @@ impl OptionalState {
}
}

#[derive(Debug, PartialEq)]
#[derive(PartialEq)]
enum DrawError {
MissingBlendColor,
MissingStencilReference,
Expand All @@ -187,6 +187,17 @@ enum DrawError {
},
}

impl fmt::Debug for DrawError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
DrawError::MissingBlendColor => write!(f, "MissingBlendColor. A blend color is required to be set using RenderPass::set_blend_color."),
DrawError::MissingStencilReference => write!(f, "MissingStencilReference. A stencil reference is required to be set using RenderPass::set_stencil_reference."),
DrawError::MissingPipeline => write!(f, "MissingPipeline. You must first set the render pipeline using RenderPass::set_pipeline."),
DrawError::IncompatibleBindGroup { index } => write!(f, "IncompatibleBindGroup. The current render pipeline has a layout which is incompatible with a currently set bind group. They first differ at entry index {}.", index),
}
}
}

#[derive(Debug)]
pub struct IndexState {
bound_buffer_view: Option<(id::BufferId, Range<BufferAddress>)>,
Expand Down

0 comments on commit 6b0751f

Please sign in to comment.