mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 13:22:23 +08:00
~ updated shader compiler to look for the first function, not just main
should fix #106 Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
e51734e4f9
commit
e5ef7bd53e
@ -245,6 +245,7 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
this->m_errorInfo = "";
|
this->m_errorInfo = "";
|
||||||
this->m_compiledContent = "";
|
this->m_compiledContent = "";
|
||||||
this->m_includesContent = "";
|
this->m_includesContent = "";
|
||||||
|
this->m_includesProcessed = false;
|
||||||
|
|
||||||
// search preprocessor macros and parse them
|
// search preprocessor macros and parse them
|
||||||
while (it != this->m_content.end () && this->m_error == false)
|
while (it != this->m_content.end () && this->m_error == false)
|
||||||
@ -434,24 +435,24 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
if (this->m_error == false)
|
if (this->m_error == false)
|
||||||
{
|
{
|
||||||
// check for main, and take it into account, this also helps adding the includes
|
// check for main, and take it into account, this also helps adding the includes
|
||||||
if (type == "void")
|
|
||||||
{
|
|
||||||
std::string name = this->extractName (it);
|
std::string name = this->extractName (it);
|
||||||
|
|
||||||
if (name == "main")
|
this->ignoreSpaces (it);
|
||||||
|
|
||||||
|
if (this->peekString ("(", it) == true)
|
||||||
|
{
|
||||||
|
if (this->m_includesProcessed == false)
|
||||||
{
|
{
|
||||||
this->m_compiledContent += "\n\n" + this->m_includesContent + "\n\n";
|
this->m_compiledContent += "\n\n" + this->m_includesContent + "\n\n";
|
||||||
|
this->m_includesProcessed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->m_compiledContent += type + " " + name + "(";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->m_compiledContent += type + " " + name;
|
this->m_compiledContent += type + " " + name;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
this->m_compiledContent += name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->m_compiledContent += type + " ";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -247,5 +247,6 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
* List of textures that the shader expects (inferred from sampler2D and it's JSON data)
|
* List of textures that the shader expects (inferred from sampler2D and it's JSON data)
|
||||||
*/
|
*/
|
||||||
std::map<int, ITexture*> m_textures;
|
std::map<int, ITexture*> m_textures;
|
||||||
|
bool m_includesProcessed = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user