mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 13:22:23 +08:00
remove define code for shaders that was generating errors
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
432814f956
commit
b58cd97255
@ -537,6 +537,8 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
"// Shader combo parameter definitions\n"
|
"// Shader combo parameter definitions\n"
|
||||||
"// ======================================================\n";
|
"// ======================================================\n";
|
||||||
|
|
||||||
|
finalCode += "// found combos from current shader\n";
|
||||||
|
|
||||||
// add combo values
|
// add combo values
|
||||||
for (const auto& cur : *this->m_foundCombos)
|
for (const auto& cur : *this->m_foundCombos)
|
||||||
{
|
{
|
||||||
@ -548,6 +550,9 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
|
|
||||||
finalCode += "#define " + cur.first + " " + std::to_string ((*combo).second) + "\n";
|
finalCode += "#define " + cur.first + " " + std::to_string ((*combo).second) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finalCode += "// combos from pass\n";
|
||||||
|
|
||||||
// add base combos that come from the pass change that MUST be added
|
// add base combos that come from the pass change that MUST be added
|
||||||
for (const auto& cur : this->m_baseCombos)
|
for (const auto& cur : this->m_baseCombos)
|
||||||
{
|
{
|
||||||
@ -558,27 +563,6 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
|
|
||||||
finalCode += "#define " + cur.first + " " + std::to_string (cur.second) + "\n";
|
finalCode += "#define " + cur.first + " " + std::to_string (cur.second) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// define to 0 everything else found in the code
|
|
||||||
std::regex ifs ("#if ([A-Za-z0-9_]+)");
|
|
||||||
auto words_begin = std::sregex_iterator (this->m_compiledContent.begin (), this->m_compiledContent.end (), ifs);
|
|
||||||
auto words_end = std::sregex_iterator ();
|
|
||||||
std::map <std::string, bool> inserted;
|
|
||||||
|
|
||||||
for (; words_begin != words_end; words_begin ++)
|
|
||||||
{
|
|
||||||
std::string define = (*words_begin).str ().substr (4);
|
|
||||||
|
|
||||||
if (
|
|
||||||
this->m_foundCombos->find (define) != this->m_foundCombos->end () ||
|
|
||||||
this->m_baseCombos.find (define) != this->m_baseCombos.end () ||
|
|
||||||
inserted.find (define) != inserted.end ())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
finalCode += "#define " + define + " 0\n";
|
|
||||||
|
|
||||||
inserted.insert_or_assign (define, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace gl_FragColor with the equivalent
|
// replace gl_FragColor with the equivalent
|
||||||
|
Loading…
Reference in New Issue
Block a user