- reverse the order of the texture list before resolving it.
Since this deletes the resolved elements one by one and needs to start at the front to ensure consistency, it is better to reverse the order so that the deletions take place at the end of the list which requires a lot less data movement. On Total Chaos this slowed down texture setup to the point where the mod was basically unlaunchable.
This commit is contained in:
parent
bc648015c7
commit
0160841dde
4 changed files with 55 additions and 3 deletions
|
|
@ -922,11 +922,21 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
|
|||
}
|
||||
// Now try to resolve the images. We only can do this at the end when all multipatch textures are set up.
|
||||
int i = 0;
|
||||
|
||||
// reverse the list so that the Delete operation in the loop below deletes at the end.
|
||||
// For normal sized lists this is of no real concern, but Total Chaos has over 250000 textures where this becomes a performance issue.
|
||||
for (unsigned i = 0; i < BuiltTextures.Size() / 2; i++)
|
||||
{
|
||||
// std::swap is VERY inefficient here...
|
||||
BuiltTextures[i].swap(BuiltTextures[BuiltTextures.Size() - 1 - i]);
|
||||
}
|
||||
|
||||
|
||||
while (BuiltTextures.Size() > 0)
|
||||
{
|
||||
bool donesomething = false;
|
||||
|
||||
for (unsigned i = 0; i < BuiltTextures.Size(); i++)
|
||||
for (int i = BuiltTextures.Size()-1; i>= 0; i--)
|
||||
{
|
||||
auto &buildinfo = BuiltTextures[i];
|
||||
bool hasEmpty = false;
|
||||
|
|
@ -969,7 +979,6 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
|
|||
}
|
||||
|
||||
BuiltTextures.Delete(i);
|
||||
i--;
|
||||
donesomething = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue