Split F2DDrawer::Flush into Draw and Clear

This commit is contained in:
Magnus Norddahl 2016-09-08 09:18:10 +02:00 committed by Christoph Oelckers
parent aaa3581ee6
commit ccbe5160b0
4 changed files with 15 additions and 8 deletions

View file

@ -378,7 +378,7 @@ void F2DDrawer::AddPixel(int x1, int y1, int palcolor, uint32 color)
// //
//========================================================================== //==========================================================================
void F2DDrawer::Flush() void F2DDrawer::Draw()
{ {
F2DDrawer::EDrawType lasttype = DrawTypeTexture; F2DDrawer::EDrawType lasttype = DrawTypeTexture;
@ -490,10 +490,12 @@ void F2DDrawer::Flush()
} }
i += dg->mLen; i += dg->mLen;
} }
mVertices.Clear();
mData.Clear();
gl_RenderState.SetVertexBuffer(GLRenderer->mVBO); gl_RenderState.SetVertexBuffer(GLRenderer->mVBO);
glset.lightmode = savedlightmode; glset.lightmode = savedlightmode;
} }
void F2DDrawer::Clear()
{
mVertices.Clear();
mData.Clear();
}

View file

@ -66,7 +66,8 @@ public:
void AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32 color); void AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32 color);
void AddPixel(int x1, int y1, int palcolor, uint32 color); void AddPixel(int x1, int y1, int palcolor, uint32 color);
void Flush(); void Draw();
void Clear();
}; };

View file

@ -397,9 +397,10 @@ void FGLRenderer::Flush()
{ {
FGLDebug::PushGroup("Eye2D"); FGLDebug::PushGroup("Eye2D");
mBuffers->BindEyeFB(eye_ix); mBuffers->BindEyeFB(eye_ix);
m2DDrawer->Flush(); // Draw the 2D m2DDrawer->Draw();
FGLDebug::PopGroup(); FGLDebug::PopGroup();
} }
m2DDrawer->Clear();
FGLPostProcessState savedState; FGLPostProcessState savedState;
FGLDebug::PushGroup("PresentEyes"); FGLDebug::PushGroup("PresentEyes");
@ -416,7 +417,9 @@ void FGLRenderer::Flush()
void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma) void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma)
{ {
m2DDrawer->Flush(); // draw all pending 2D stuff before copying the buffer m2DDrawer->Draw(); // draw all pending 2D stuff before copying the buffer
m2DDrawer->Clear();
FGLDebug::PushGroup("CopyToBackbuffer"); FGLDebug::PushGroup("CopyToBackbuffer");
if (FGLRenderBuffers::IsEnabled()) if (FGLRenderBuffers::IsEnabled())
{ {

View file

@ -189,7 +189,8 @@ bool OpenGLFrameBuffer::WipeStartScreen(int type)
void OpenGLFrameBuffer::WipeEndScreen() void OpenGLFrameBuffer::WipeEndScreen()
{ {
GLRenderer->m2DDrawer->Flush(); GLRenderer->m2DDrawer->Draw();
GLRenderer->m2DDrawer->Clear();
const auto &viewport = GLRenderer->mScreenViewport; const auto &viewport = GLRenderer->mScreenViewport;
wipeendscreen = new FHardwareTexture(viewport.width, viewport.height, true); wipeendscreen = new FHardwareTexture(viewport.width, viewport.height, true);