mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
feat(wgsl-in): use more general enable
-not-set diag. w/ unimpl. hint
This commit is contained in:
parent
bf4cd9cd31
commit
d539466997
@ -283,6 +283,10 @@ pub(crate) enum Error<'a> {
|
|||||||
kind: UnimplementedEnableExtension,
|
kind: UnimplementedEnableExtension,
|
||||||
span: Span,
|
span: Span,
|
||||||
},
|
},
|
||||||
|
EnableExtensionNotEnabled {
|
||||||
|
kind: EnableExtension,
|
||||||
|
span: Span,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -945,6 +949,33 @@ impl<'a> Error<'a> {
|
|||||||
kind.tracking_issue_num()
|
kind.tracking_issue_num()
|
||||||
)],
|
)],
|
||||||
},
|
},
|
||||||
|
Error::EnableExtensionNotEnabled { kind, span } => ParseError {
|
||||||
|
message: format!("`{}` enable extension is not enabled", kind.to_ident()),
|
||||||
|
labels: vec![(
|
||||||
|
span,
|
||||||
|
format!(
|
||||||
|
concat!(
|
||||||
|
"the `{}` enable extension is needed for this functionality, ",
|
||||||
|
"but it is not currently enabled"
|
||||||
|
),
|
||||||
|
kind.to_ident()
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
)],
|
||||||
|
notes: if let EnableExtension::Unimplemented(kind) = kind {
|
||||||
|
vec![format!(
|
||||||
|
concat!(
|
||||||
|
"This extension is not yet implemented. ",
|
||||||
|
"Let Naga maintainers know that you ran into this at ",
|
||||||
|
"<https://github.com/gfx-rs/wgpu/issues/{}>, ",
|
||||||
|
"so they can prioritize it!"
|
||||||
|
),
|
||||||
|
kind.tracking_issue_num()
|
||||||
|
)]
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
use crate::front::wgsl::error::{Error, ExpectedToken};
|
use crate::front::wgsl::error::{Error, ExpectedToken};
|
||||||
use crate::front::wgsl::parse::directive::enable_extension::{EnableExtension, EnableExtensions};
|
use crate::front::wgsl::parse::directive::enable_extension::{
|
||||||
|
EnableExtension, EnableExtensions, UnimplementedEnableExtension,
|
||||||
|
};
|
||||||
use crate::front::wgsl::parse::directive::DirectiveKind;
|
use crate::front::wgsl::parse::directive::DirectiveKind;
|
||||||
use crate::front::wgsl::parse::lexer::{Lexer, Token};
|
use crate::front::wgsl::parse::lexer::{Lexer, Token};
|
||||||
use crate::front::wgsl::parse::number::Number;
|
use crate::front::wgsl::parse::number::Number;
|
||||||
@ -667,7 +669,15 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
(Token::Number(res), span) => {
|
(Token::Number(res), span) => {
|
||||||
let _ = lexer.next();
|
let _ = lexer.next();
|
||||||
let num = res.map_err(|err| Error::BadNumber(span, err))?;
|
let num = res.map_err(|err| match err {
|
||||||
|
super::error::NumberError::UnimplementedF16 => {
|
||||||
|
Error::EnableExtensionNotEnabled {
|
||||||
|
kind: EnableExtension::Unimplemented(UnimplementedEnableExtension::F16),
|
||||||
|
span,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err => Error::BadNumber(span, err),
|
||||||
|
})?;
|
||||||
ast::Expression::Literal(ast::Literal::Number(num))
|
ast::Expression::Literal(ast::Literal::Number(num))
|
||||||
}
|
}
|
||||||
(Token::Word("RAY_FLAG_NONE"), _) => {
|
(Token::Word("RAY_FLAG_NONE"), _) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user