summaryrefslogtreecommitdiff
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorTim Foley <tim.foley.is@gmail.com>2017-07-08 18:58:42 -0700
committerGitHub <noreply@github.com>2017-07-08 18:58:42 -0700
commit68df74b58a56b0a1fb19b9ec4ff0282969cd6a12 (patch)
tree5eaa7eaab892504db53cca4b8044b0c8bcde58b3 /source/slang/slang.cpp
parentc07a6e6b5f5e0e4839b435ff6c15b821b6dead11 (diff)
parent767d47a842700653b8deffe82ccb3c85ad582c13 (diff)
Merge pull request #60 from tfoleyNV/revise-rewriter
Revise rewriter
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index c4944c5a4..e5bfcb923 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -25,8 +25,9 @@ public:
bool useCache = false;
String cacheDir;
- RefPtr<Scope> slangLanguageScope;
+ RefPtr<Scope> coreLanguageScope;
RefPtr<Scope> hlslLanguageScope;
+ RefPtr<Scope> slangLanguageScope;
RefPtr<Scope> glslLanguageScope;
List<RefPtr<ProgramSyntaxNode>> loadedModuleCode;
@@ -43,15 +44,19 @@ public:
// TODO: load these on-demand to avoid parsing
// stdlib code for languages the user won't use.
- slangLanguageScope = new Scope();
+ coreLanguageScope = new Scope();
hlslLanguageScope = new Scope();
- hlslLanguageScope->parent = slangLanguageScope;
+ hlslLanguageScope->nextSibling = coreLanguageScope;
+
+ slangLanguageScope = new Scope();
+ slangLanguageScope->nextSibling = hlslLanguageScope;
glslLanguageScope = new Scope();
- glslLanguageScope->parent = slangLanguageScope;
+ glslLanguageScope->nextSibling = coreLanguageScope;
- addBuiltinSource(slangLanguageScope, "stdlib", SlangStdLib::GetCode());
+ addBuiltinSource(coreLanguageScope, "core", getCoreLibraryCode());
+ addBuiltinSource(hlslLanguageScope, "hlsl", getHLSLLibraryCode());
addBuiltinSource(glslLanguageScope, "glsl", getGLSLLibraryCode());
}
@@ -61,7 +66,7 @@ public:
// code that we might have allocated and loaded into static
// variables (TODO: don't use `static` variables for this stuff)
- SlangStdLib::Finalize();
+ finalizeShaderLibrary();
// Ditto for our type represnetation stuff