mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Improve drawing error messages
This commit is contained in:
parent
b51162c2c6
commit
78b4ccfb97
@ -29,7 +29,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>;
|
||||
@ -174,7 +174,7 @@ impl OptionalState {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(PartialEq)]
|
||||
enum DrawError {
|
||||
MissingBlendColor,
|
||||
MissingStencilReference,
|
||||
@ -186,6 +186,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>)>,
|
||||
|
Loading…
Reference in New Issue
Block a user