mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +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;
|
offset = osave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TArray<RefCountedPtr<DShape2DBufferInfo>> buffersToDestroy;
|
||||||
|
|
||||||
void DShape2D::OnDestroy() {
|
void DShape2D::OnDestroy() {
|
||||||
if (lastParms) delete lastParms;
|
if (lastParms) delete lastParms;
|
||||||
lastParms = nullptr;
|
lastParms = nullptr;
|
||||||
mIndices.Reset();
|
mIndices.Reset();
|
||||||
mVertices.Reset();
|
mVertices.Reset();
|
||||||
mCoords.Reset();
|
mCoords.Reset();
|
||||||
bufferInfo = nullptr;
|
buffersToDestroy.Push(std::move(bufferInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1082,6 +1084,17 @@ void F2DDrawer::Clear()
|
||||||
screenFade = 1.f;
|
screenFade = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void F2DDrawer::OnFrameDone()
|
||||||
|
{
|
||||||
|
buffersToDestroy.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
F2DVertexBuffer::F2DVertexBuffer()
|
F2DVertexBuffer::F2DVertexBuffer()
|
||||||
{
|
{
|
||||||
mVertexBuffer = screen->CreateVertexBuffer();
|
mVertexBuffer = screen->CreateVertexBuffer();
|
||||||
|
|
|
@ -216,6 +216,7 @@ public:
|
||||||
void Begin(int w, int h) { isIn2D = true; Width = w; Height = h; }
|
void Begin(int w, int h) { isIn2D = true; Width = w; Height = h; }
|
||||||
void End() { isIn2D = false; }
|
void End() { isIn2D = false; }
|
||||||
bool HasBegun2D() { return isIn2D; }
|
bool HasBegun2D() { return isIn2D; }
|
||||||
|
void OnFrameDone();
|
||||||
|
|
||||||
void ClearClipRect() { clipleft = cliptop = 0; clipwidth = clipheight = -1; }
|
void ClearClipRect() { clipleft = cliptop = 0; clipwidth = clipheight = -1; }
|
||||||
void SetClipRect(int x, int y, int w, int h);
|
void SetClipRect(int x, int y, int w, int h);
|
||||||
|
|
|
@ -903,6 +903,7 @@ static void End2DAndUpdate()
|
||||||
twod->End();
|
twod->End();
|
||||||
CheckBench();
|
CheckBench();
|
||||||
screen->Update();
|
screen->Update();
|
||||||
|
twod->OnFrameDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue