mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
Fixed regression for spritesheets not working properly
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
7b7d699371
commit
a13d2f265b
@ -43,7 +43,8 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
m_error (""),
|
m_error (""),
|
||||||
m_errorInfo (""),
|
m_errorInfo (""),
|
||||||
m_constants (constants),
|
m_constants (constants),
|
||||||
m_container (container)
|
m_container (container),
|
||||||
|
m_baseCombos ()
|
||||||
{
|
{
|
||||||
if (type == Type_Vertex)
|
if (type == Type_Vertex)
|
||||||
this->m_content = this->m_container->readVertexShader (this->m_file);
|
this->m_content = this->m_container->readVertexShader (this->m_file);
|
||||||
@ -51,6 +52,13 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
this->m_content = this->m_container->readFragmentShader (this->m_file);
|
this->m_content = this->m_container->readFragmentShader (this->m_file);
|
||||||
else if (type == Type_Include)
|
else if (type == Type_Include)
|
||||||
this->m_content = this->m_container->readIncludeShader (this->m_file);
|
this->m_content = this->m_container->readIncludeShader (this->m_file);
|
||||||
|
|
||||||
|
// clone the combos into the baseCombos to keep track of values that must be embedded no matter what
|
||||||
|
auto cur = this->m_combos->begin ();
|
||||||
|
auto end = this->m_combos->end ();
|
||||||
|
|
||||||
|
for (; cur != end; cur ++)
|
||||||
|
this->m_baseCombos.insert (std::make_pair ((*cur).first, (*cur).second));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Compiler::peekString(std::string str, std::string::const_iterator& it)
|
bool Compiler::peekString(std::string str, std::string::const_iterator& it)
|
||||||
@ -515,19 +523,36 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
"// Shader combo parameter definitions\n"
|
"// Shader combo parameter definitions\n"
|
||||||
"// ======================================================\n";
|
"// ======================================================\n";
|
||||||
|
|
||||||
// add combo values
|
|
||||||
auto cur = this->m_foundCombos->begin ();
|
|
||||||
auto end = this->m_foundCombos->end ();
|
|
||||||
|
|
||||||
for (; cur != end; cur ++)
|
|
||||||
{
|
{
|
||||||
// find the right value for the combo in the combos map
|
// add combo values
|
||||||
auto combo = this->m_combos->find ((*cur).first);
|
auto cur = this->m_foundCombos->begin ();
|
||||||
|
auto end = this->m_foundCombos->end ();
|
||||||
|
|
||||||
if (combo == this->m_combos->end ())
|
for (; cur != end; cur++)
|
||||||
continue;
|
{
|
||||||
|
// find the right value for the combo in the combos map
|
||||||
|
auto combo = this->m_combos->find ((*cur).first);
|
||||||
|
|
||||||
finalCode += "#define " + (*cur).first + " " + std::to_string ((*combo).second) + "\n";
|
if (combo == this->m_combos->end ())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
finalCode += "#define " + (*cur).first + " " + std::to_string ((*combo).second) + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// add base combos that come from the pass change that MUST be added
|
||||||
|
{
|
||||||
|
auto cur = this->m_baseCombos.begin ();
|
||||||
|
auto end = this->m_baseCombos.end ();
|
||||||
|
|
||||||
|
for (; cur != end; cur ++)
|
||||||
|
{
|
||||||
|
auto alreadyFound = this->m_foundCombos->find ((*cur).first);
|
||||||
|
|
||||||
|
if (alreadyFound != this->m_foundCombos->end ())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
finalCode += "#define " + (*cur).first + " " + std::to_string ((*cur).second) + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,6 +234,11 @@ namespace WallpaperEngine::Render::Shaders
|
|||||||
*/
|
*/
|
||||||
std::map <std::string, int>* m_combos;
|
std::map <std::string, int>* m_combos;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combos that come from the pass' chain that should be added
|
||||||
|
*/
|
||||||
|
std::map <std::string, int> m_baseCombos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The combos the shader code has defined (shared between fragment and vertex)
|
* The combos the shader code has defined (shared between fragment and vertex)
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user