Texture identifier collision avoidance for Metal

This commit is contained in:
Jack Andersen 2017-03-05 13:34:55 -10:00
parent 437fd54400
commit 3b7c7cf0fc
2 changed files with 13 additions and 4 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit a547eb9dbb0a986f29d4a2d8072a858f3e98a100
Subproject commit 3b7a5781f59be5260d919b3abed1403a39086c93

View File

@ -285,10 +285,18 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
if (post.m_entry)
postEntry = post.m_entry;
int extTexBits = 0;
for (int i=0 ; i<extTexCount ; ++i)
{
const TextureInfo& extTex = extTexs[i];
extTexBits |= 1 << extTex.mapIdx;
}
std::string texMapDecl;
if (m_texMapEnd)
{
for (int i=0 ; i<m_texMapEnd ; ++i)
if (!(extTexBits & (1 << i)))
texMapDecl += hecl::Format(",\ntexture2d<float> tex%u [[ texture(%u) ]]", i, i);
}
@ -298,8 +306,9 @@ std::string Metal::makeFrag(size_t blockCount, const char** blockNames, bool alp
const TextureInfo& extTex = extTexs[i];
if (extTexCall.size())
extTexCall += ", ";
extTexCall += hecl::Format("extTex%u", extTex.mapIdx);
texMapDecl += hecl::Format(",\ntexture2d<float> extTex%u [[ texture(%u) ]]", extTex.mapIdx, extTex.mapIdx);
extTexCall += hecl::Format("tex%u", extTex.mapIdx);
texMapDecl += hecl::Format(",\ntexture2d<float> tex%u [[ texture(%u) ]]", extTex.mapIdx, extTex.mapIdx);
extTexBits |= 1 << extTex.mapIdx;
}
std::string blockCall;