Updated the includer interface to allow relative includes.

This plumbs both the current file path and the include depth
back up to the includer. This allows the includer to properly
support relative paths.

This also replaces the string copy that was done during include
with a zero-copy method of accomplishing the same thing. This
prevents extra copies of entire files.
This commit is contained in:
Andrew Woloszyn
2016-03-07 13:23:09 -05:00
parent f2d8a5c53f
commit a132af5b78
7 changed files with 220 additions and 54 deletions

View File

@@ -699,8 +699,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
if (Options & EOptionOutputPreprocessed) {
std::string str;
glslang::TShader::ForbidInclude includer;
if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false,
messages, &str, glslang::TShader::ForbidInclude())) {
messages, &str, includer)) {
PutsIfNonEmpty(str.c_str());
} else {
CompileFailed = true;