Skip to content

Commit

Permalink
xrRender: refactor compare ShaderElements
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Oct 5, 2018
1 parent b2931c3 commit 3721a94
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/Layers/xrRender/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,26 @@ BOOL ShaderElement::equal(ShaderElement& S)
return TRUE;
}

BOOL ShaderElement::equal(ShaderElement* S)
BOOL Shader::equal(Shader* S, int index)
{
if (nullptr == S && nullptr == this)
if(nullptr == E[index] && nullptr == S->E[index])
return TRUE;
if (nullptr == S || nullptr == this)
if(nullptr == E[index] || nullptr == S->E[index])
return FALSE;
return equal(*S);

return (E[index] == S->E[index]);
}

//
BOOL Shader::equal(Shader& S)
BOOL Shader::equal(Shader* S)
{
return E[0]->equal(&*S.E[0]) && E[1]->equal(&*S.E[1]) && E[2]->equal(&*S.E[2]) && E[3]->equal(&*S.E[3]) &&
E[4]->equal(&*S.E[4]);
for (int i = 0; i < 4; i++)
{
if (!equal(S, i))
return FALSE;
}
return TRUE;
}
BOOL Shader::equal(Shader* S) { return equal(*S); }

void STextureList::clear()
{
iterator it = begin();
Expand Down
1 change: 1 addition & 0 deletions src/Layers/xrRender/Shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ struct ECORE_API Shader : public xr_resource_flagged
~Shader();
BOOL equal(Shader& S);
BOOL equal(Shader* S);
BOOL equal(Shader* S, int index);
};

struct ECORE_API resptrcode_shader : public resptr_base<Shader>
Expand Down

0 comments on commit 3721a94

Please sign in to comment.