diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-07-12 14:21:52 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-07-12 14:21:52 -0700 |
| commit | 02f77bbf12981abe376b2d5987684224a50ae4b2 (patch) | |
| tree | 156c36903426a4f18f0e4c857d9d9eb987459789 /source/slang/parser.cpp | |
| parent | d43ee03c6101ce76331135cebdc57711cb3a2020 (diff) | |
Add ability for intrinsics to require GLSL extensions
When cross-compiling, we need to detect when an intrinsic is used that required non-default GLSL capabilities and emit an appropriate `#extension ... : require` line.
I'm handling this by attaching a custom modifier to declarations that require an extension in order to be callable.
Diffstat (limited to 'source/slang/parser.cpp')
| -rw-r--r-- | source/slang/parser.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index de63793b1..8314b0930 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -717,6 +717,17 @@ namespace Slang AddModifier(&modifierLink, modifier); } + else if (AdvanceIf(parser, "__glsl_extension")) + { + auto modifier = new RequiredGLSLExtensionModifier(); + modifier->Position = loc; + + parser->ReadToken(TokenType::LParent); + modifier->extensionNameToken = parser->ReadToken(TokenType::Identifier); + parser->ReadToken(TokenType::RParent); + + AddModifier(&modifierLink, modifier); + } else if (AdvanceIf(parser, "layout")) { |
