From 8a8a387379388d4818d2eb4d5682f43c48a45c54 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 7 Jun 2022 11:54:53 +0200 Subject: [PATCH] Expose the source location in CreateShaderModuleError. --- wgpu-core/src/pipeline.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 34a57efcd03..164c45847f1 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -126,6 +126,16 @@ pub enum CreateShaderModuleError { MissingFeatures(#[from] MissingFeatures), } +impl CreateShaderModuleError { + pub fn location(&self, source: &str) -> Option { + 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))]