- added an OnDestroy method to Shape2D so that its users can explicitly free the data it holds.

In this case it is very important to care about management, because this class will hold GPU-side buffers!
This commit is contained in:
Christoph Oelckers 2021-06-28 22:21:27 +02:00
parent 3bef08b1aa
commit 9b4a4157b9
2 changed files with 8 additions and 3 deletions

View file

@ -528,8 +528,13 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
offset = osave; offset = osave;
} }
DShape2D::~DShape2D() { void DShape2D::OnDestroy() {
delete lastParms; if (lastParms) delete lastParms;
lastParms = nullptr;
mIndices.Reset();
mVertices.Reset();
mCoords.Reset();
buffers.Reset();
} }
//========================================================================== //==========================================================================

View file

@ -269,7 +269,7 @@ public:
bool uploadedOnce = false; bool uploadedOnce = false;
DrawParms* lastParms; DrawParms* lastParms;
~DShape2D(); void OnDestroy() override;
}; };