- Changed frame buffer locking mechanism so that the only place where a lock is needed is when the software renderer wants to access the render buffer, which is precisely for the duration of the RenderView function.

No more locking insanity! :)
There are no locking counters or other saveguards here that would complicate the implementation because there's precisely two places where this buffer must be locked - the RenderView functions of the regular and poly SW renderer which cannot be called recursively.
This commit is contained in:
Christoph Oelckers 2018-03-27 20:02:44 +02:00
commit 2ed744963c
8 changed files with 99 additions and 126 deletions

View file

@ -59,18 +59,22 @@ void PolyRenderer::RenderView(player_t *player)
{
using namespace swrenderer;
RenderTarget = screen->GetCanvas();
if (screen->LockCanvas())
{
RenderTarget = screen->GetCanvas();
int width = SCREENWIDTH;
int height = SCREENHEIGHT;
float trueratio;
ActiveRatio(width, height, &trueratio);
//viewport->SetViewport(&Thread, width, height, trueratio);
int width = SCREENWIDTH;
int height = SCREENHEIGHT;
float trueratio;
ActiveRatio(width, height, &trueratio);
//viewport->SetViewport(&Thread, width, height, trueratio);
RenderActorView(player->mo, false);
RenderActorView(player->mo, false);
Threads.MainThread()->FlushDrawQueue();
DrawerThreads::WaitForWorkers();
Threads.MainThread()->FlushDrawQueue();
DrawerThreads::WaitForWorkers();
screen->UnlockCanvas();
}
}
void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines)