1
1
forked from 0ad/0ad

Moves GL error check after SwapBuffers to decrease a possible synchronization during rendering process.

Comments By: Stan, elexis
Differential Revision: https://code.wildfiregames.com/D2600
This was SVN commit r23462.
This commit is contained in:
Vladislav Belov 2020-01-29 22:03:44 +00:00
parent 1fdcb80850
commit ecc7d2913e
4 changed files with 19 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games. /* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -420,6 +420,8 @@ static void Frame()
SDL_GL_SwapWindow(g_VideoMode.GetWindow()); SDL_GL_SwapWindow(g_VideoMode.GetWindow());
ogl_WarnIfError(); ogl_WarnIfError();
} }
g_Renderer.OnSwapBuffers();
} }
g_Profiler.Frame(); g_Profiler.Frame();

View File

@ -1456,17 +1456,16 @@ void CRenderer::EndFrame()
m->Model.TranspUnskinned->EndFrame(); m->Model.TranspUnskinned->EndFrame();
ogl_tex_bind(0, 0); ogl_tex_bind(0, 0);
{
PROFILE3("error check");
int err = glGetError();
if (err)
{
ONCE(LOGERROR("CRenderer::EndFrame: GL errors %s (%04x) occurred", ogl_GetErrorName(err), err));
}
}
} }
void CRenderer::OnSwapBuffers()
{
PROFILE3("error check");
// We have to check GL errors after SwapBuffer to avoid possible
// synchronizations during rendering.
//if (GLenum err = glGetError())
// ONCE(LOGERROR("GL error %s (0x%04x) occurred", ogl_GetErrorName(err), err));
}
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// DisplayFrustum: debug displays // DisplayFrustum: debug displays

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games. /* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -137,6 +137,11 @@ public:
// signal frame end // signal frame end
void EndFrame(); void EndFrame();
/**
* Should be called after each SwapBuffers call.
*/
void OnSwapBuffers();
/** /**
* Set simulation context for rendering purposes. * Set simulation context for rendering purposes.
* Must be called at least once when the game has started and before * Must be called at least once when the game has started and before

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games. /* Copyright (C) 2020 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -231,6 +231,7 @@ void AtlasViewGame::Render()
::Render(); ::Render();
Atlas_GLSwapBuffers((void*)g_AtlasGameLoop->glCanvas); Atlas_GLSwapBuffers((void*)g_AtlasGameLoop->glCanvas);
g_Renderer.OnSwapBuffers();
} }
void AtlasViewGame::DrawCinemaPathTool() void AtlasViewGame::DrawCinemaPathTool()