deallocate pipeline in renderer on pipeline destroy

This commit is contained in:
h4570
2022-07-30 18:17:48 +02:00
parent 1bdb33e1a6
commit 927c10e82a
6 changed files with 20 additions and 3 deletions
+9
View File
@@ -21,8 +21,17 @@ void Renderer3D::usePipeline(Renderer3DPipeline* pipeline) {
if (currentPipeline != pipeline) {
if (currentPipeline) currentPipeline->onUseEnd();
currentPipeline = pipeline;
currentPipeline->onDestroy =
std::bind(&Renderer3D::onDestroy, this, std::placeholders::_1);
currentPipeline->onUse();
}
}
void Renderer3D::onDestroy(Renderer3DPipeline* pipeline) {
if (currentPipeline == pipeline) {
currentPipeline->onUseEnd();
currentPipeline = nullptr;
}
}
} // namespace Tyra