diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-07-06 20:40:42 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-07-07 10:00:24 -0700 |
| commit | 4921bdbe0d75f1ad29fae18920678287919a2e29 (patch) | |
| tree | 59703fc84cd06b63b0c349197268d2b782a5b699 | |
| parent | 56b44cbf582fac32e31601fd2a7ae1d6cb8f71b2 (diff) | |
Eliminate `typedef`s when lowering to GLSL
GLSL doesn't support `typedef` declarations.
The lowering code already lowered any named types (references to `typedef`s) to their underlying definition when targetting GLSL.
This changes makes sure that we also don't generate any lowered output for `typedef` declarations in the source program.
| -rw-r--r-- | source/slang/lower.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/lower.cpp b/source/slang/lower.cpp index 8bc9619f3..b90573495 100644 --- a/source/slang/lower.cpp +++ b/source/slang/lower.cpp @@ -1059,6 +1059,12 @@ struct LoweringVisitor RefPtr<Decl> visitTypeDefDecl(TypeDefDecl* decl) { + if (shared->target == CodeGenTarget::GLSL) + { + // GLSL does not support `typedef`, so we will lower it out of existence here + return nullptr; + } + RefPtr<TypeDefDecl> loweredDecl = new TypeDefDecl(); lowerDeclCommon(loweredDecl, decl); |
