mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- extended 2D buffer lifetime to the end of the frame
This commit is contained in:
parent
387aef27ad
commit
ed606b8ed3
3 changed files with 16 additions and 1 deletions
|
@ -528,13 +528,15 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
|||
offset = osave;
|
||||
}
|
||||
|
||||
static TArray<RefCountedPtr<DShape2DBufferInfo>> buffersToDestroy;
|
||||
|
||||
void DShape2D::OnDestroy() {
|
||||
if (lastParms) delete lastParms;
|
||||
lastParms = nullptr;
|
||||
mIndices.Reset();
|
||||
mVertices.Reset();
|
||||
mCoords.Reset();
|
||||
bufferInfo = nullptr;
|
||||
buffersToDestroy.Push(std::move(bufferInfo));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1082,6 +1084,17 @@ void F2DDrawer::Clear()
|
|||
screenFade = 1.f;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::OnFrameDone()
|
||||
{
|
||||
buffersToDestroy.Clear();
|
||||
}
|
||||
|
||||
F2DVertexBuffer::F2DVertexBuffer()
|
||||
{
|
||||
mVertexBuffer = screen->CreateVertexBuffer();
|
||||
|
|
|
@ -216,6 +216,7 @@ public:
|
|||
void Begin(int w, int h) { isIn2D = true; Width = w; Height = h; }
|
||||
void End() { isIn2D = false; }
|
||||
bool HasBegun2D() { return isIn2D; }
|
||||
void OnFrameDone();
|
||||
|
||||
void ClearClipRect() { clipleft = cliptop = 0; clipwidth = clipheight = -1; }
|
||||
void SetClipRect(int x, int y, int w, int h);
|
||||
|
|
|
@ -903,6 +903,7 @@ static void End2DAndUpdate()
|
|||
twod->End();
|
||||
CheckBench();
|
||||
screen->Update();
|
||||
twod->OnFrameDone();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue