mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
Fix TextureBaker failures and heap corruption in MaterialBaker
This commit is contained in:
parent
5856ab3d3a
commit
39cf3c3d83
1 changed files with 6 additions and 1 deletions
|
@ -144,7 +144,12 @@ void MaterialBaker::processMaterial() {
|
||||||
connect(textureBaker.data(), &TextureBaker::finished, this, &MaterialBaker::handleFinishedTextureBaker);
|
connect(textureBaker.data(), &TextureBaker::finished, this, &MaterialBaker::handleFinishedTextureBaker);
|
||||||
_textureBakers.insert(textureKey, textureBaker);
|
_textureBakers.insert(textureKey, textureBaker);
|
||||||
textureBaker->moveToThread(_getNextOvenWorkerThreadOperator ? _getNextOvenWorkerThreadOperator() : thread());
|
textureBaker->moveToThread(_getNextOvenWorkerThreadOperator ? _getNextOvenWorkerThreadOperator() : thread());
|
||||||
QMetaObject::invokeMethod(textureBaker.data(), "bake");
|
// By default, Qt will invoke this bake immediately if the TextureBaker is on the same worker thread as this MaterialBaker.
|
||||||
|
// We don't want that, because threads may be waiting for work while this thread is stuck processing a TextureBaker.
|
||||||
|
// On top of that, _textureBakers isn't fully populated.
|
||||||
|
// So, use Qt::QueuedConnection.
|
||||||
|
// TODO: Better thread utilization at the top level, not just the MaterialBaker level
|
||||||
|
QMetaObject::invokeMethod(textureBaker.data(), "bake", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
_materialsNeedingRewrite.insert(textureKey, networkMaterial.second);
|
_materialsNeedingRewrite.insert(textureKey, networkMaterial.second);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue