Skip to content

Commit

Permalink
Expose the source location in CreateShaderModuleError.
Browse files Browse the repository at this point in the history
  • Loading branch information
nical committed Jun 13, 2022
1 parent f94f25f commit d9678cd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wgpu-core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ pub enum CreateShaderModuleError {
MissingFeatures(#[from] MissingFeatures),
}

impl CreateShaderModuleError {
pub fn location(&self, source: &str) -> Option<naga::SourceLocation> {
match *self {
CreateShaderModuleError::Parsing(ref err) => err.inner.location(source),
CreateShaderModuleError::Validation(ref err) => err.inner.location(source),
_ => None,
}
}
}

/// Describes a programmable pipeline stage.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "trace", derive(serde::Serialize))]
Expand Down

0 comments on commit d9678cd

Please sign in to comment.