~ quick fix for shader compilation with nested includes, should fix #103

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2022-06-09 12:12:27 +02:00
parent 46ea8e8f03
commit cf2e31a606

View File

@ -265,12 +265,21 @@ namespace WallpaperEngine::Render::Shaders
// extract value between quotes
filename = this->extractQuotedValue (it); BREAK_IF_ERROR
if (this->m_content.find (" main(") == std::string::npos && this->m_content.find (" main (") == std::string::npos)
{
this->m_compiledContent += "// begin of include from file " + filename + "\r\n";
this->m_compiledContent += this->lookupShaderFile (filename);
this->m_compiledContent += "\r\n// end of included from file " + filename + "\r\n";
}
else
{
// load the content to the includes contents and continue with the next one
// try to find the file first
this->m_includesContent += "// begin of included from file " + filename + "\r\n";
this->m_includesContent += this->lookupShaderFile (filename);
this->m_includesContent += "\r\n// end of included from file " + filename + "\r\n";
}
}
else
{
this->m_compiledContent += '#';