deallocate pipeline in renderer on pipeline destroy
This commit is contained in:
@@ -17,7 +17,9 @@ const u32 DynamicPipeline::halfBuffersCount = buffersCount / 2;
|
||||
|
||||
DynamicPipeline::DynamicPipeline() {}
|
||||
|
||||
DynamicPipeline::~DynamicPipeline() {}
|
||||
DynamicPipeline::~DynamicPipeline() {
|
||||
if (onDestroy) onDestroy(this);
|
||||
}
|
||||
|
||||
void DynamicPipeline::setRenderer(RendererCore* t_core) {
|
||||
rendererCore = t_core;
|
||||
|
||||
@@ -21,6 +21,7 @@ MinecraftPipeline::MinecraftPipeline() {
|
||||
}
|
||||
|
||||
MinecraftPipeline::~MinecraftPipeline() {
|
||||
if (onDestroy) onDestroy(this);
|
||||
if (bbox) {
|
||||
delete bbox;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ namespace Tyra {
|
||||
|
||||
StaticPipeline::StaticPipeline() {}
|
||||
|
||||
StaticPipeline::~StaticPipeline() {}
|
||||
StaticPipeline::~StaticPipeline() {
|
||||
if (onDestroy) onDestroy(this);
|
||||
}
|
||||
|
||||
void StaticPipeline::setRenderer(RendererCore* t_core) {
|
||||
rendererCore = t_core;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user