mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
This commit is contained in:
commit
c15880a2fc
7 changed files with 37 additions and 51 deletions
|
@ -819,6 +819,8 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, f
|
||||||
stereo3dMode.SetUp();
|
stereo3dMode.SetUp();
|
||||||
for (int eye_ix = 0; eye_ix < stereo3dMode.eye_count(); ++eye_ix)
|
for (int eye_ix = 0; eye_ix < stereo3dMode.eye_count(); ++eye_ix)
|
||||||
{
|
{
|
||||||
|
if (eye_ix > 0)
|
||||||
|
SetFixedColormap(camera->player); // reiterate color map for each eye, so night vision goggles work in both eyes
|
||||||
const s3d::EyePose * eye = stereo3dMode.getEyePose(eye_ix);
|
const s3d::EyePose * eye = stereo3dMode.getEyePose(eye_ix);
|
||||||
eye->SetUp();
|
eye->SetUp();
|
||||||
GLRenderer->SetOutputViewport(bounds);
|
GLRenderer->SetOutputViewport(bounds);
|
||||||
|
|
|
@ -331,6 +331,9 @@ namespace swrenderer
|
||||||
|
|
||||||
int VisiblePlaneList::Render()
|
int VisiblePlaneList::Render()
|
||||||
{
|
{
|
||||||
|
if (Thread->MainThread)
|
||||||
|
PlaneCycles.Clock();
|
||||||
|
|
||||||
VisiblePlane *pl;
|
VisiblePlane *pl;
|
||||||
int i;
|
int i;
|
||||||
int vpcount = 0;
|
int vpcount = 0;
|
||||||
|
@ -351,6 +354,10 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Thread->MainThread)
|
||||||
|
PlaneCycles.Unclock();
|
||||||
|
|
||||||
return vpcount;
|
return vpcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -779,11 +779,17 @@ namespace swrenderer
|
||||||
|
|
||||||
void RenderOpaquePass::RenderScene()
|
void RenderOpaquePass::RenderScene()
|
||||||
{
|
{
|
||||||
|
if (Thread->MainThread)
|
||||||
|
WallCycles.Clock();
|
||||||
|
|
||||||
SeenSpriteSectors.clear();
|
SeenSpriteSectors.clear();
|
||||||
SeenActors.clear();
|
SeenActors.clear();
|
||||||
|
|
||||||
InSubsector = nullptr;
|
InSubsector = nullptr;
|
||||||
RenderBSPNode(level.HeadNode()); // The head node is the last node output.
|
RenderBSPNode(level.HeadNode()); // The head node is the last node output.
|
||||||
|
|
||||||
|
if (Thread->MainThread)
|
||||||
|
WallCycles.Unclock();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -438,10 +438,8 @@ namespace swrenderer
|
||||||
Thread->Clip3D->ResetClip(); // reset clips (floor/ceiling)
|
Thread->Clip3D->ResetClip(); // reset clips (floor/ceiling)
|
||||||
if (!savedvisibility && viewpoint.camera) viewpoint.camera->renderflags &= ~RF_INVISIBLE;
|
if (!savedvisibility && viewpoint.camera) viewpoint.camera->renderflags &= ~RF_INVISIBLE;
|
||||||
|
|
||||||
PlaneCycles.Clock();
|
|
||||||
Thread->PlaneList->Render();
|
Thread->PlaneList->Render();
|
||||||
RenderPlanePortals();
|
RenderPlanePortals();
|
||||||
PlaneCycles.Unclock();
|
|
||||||
|
|
||||||
double vzp = viewpoint.Pos.Z;
|
double vzp = viewpoint.Pos.Z;
|
||||||
|
|
||||||
|
@ -458,9 +456,7 @@ namespace swrenderer
|
||||||
if (Thread->MainThread)
|
if (Thread->MainThread)
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
MaskedCycles.Clock(); // [ZZ] count sprites in portals/mirrors along with normal ones.
|
|
||||||
Thread->TranslucentPass->Render(); // this is required since with portals there often will be cases when more than 80% of the view is inside a portal.
|
Thread->TranslucentPass->Render(); // this is required since with portals there often will be cases when more than 80% of the view is inside a portal.
|
||||||
MaskedCycles.Unclock();
|
|
||||||
|
|
||||||
if (Thread->MainThread)
|
if (Thread->MainThread)
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
|
@ -70,7 +70,7 @@ CVAR(Bool, r_scene_multithreaded, false, 0);
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
cycle_t WallCycles, PlaneCycles, MaskedCycles, DrawerWaitCycles;
|
||||||
|
|
||||||
RenderScene::RenderScene()
|
RenderScene::RenderScene()
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,9 @@ namespace swrenderer
|
||||||
DrawerThreads::Execute(queue);
|
DrawerThreads::Execute(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawerWaitCycles.Clock();
|
||||||
DrawerThreads::WaitForWorkers();
|
DrawerThreads::WaitForWorkers();
|
||||||
|
DrawerWaitCycles.Unclock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderScene::RenderActorView(AActor *actor, bool dontmaplines)
|
void RenderScene::RenderActorView(AActor *actor, bool dontmaplines)
|
||||||
|
@ -132,7 +134,7 @@ namespace swrenderer
|
||||||
WallCycles.Reset();
|
WallCycles.Reset();
|
||||||
PlaneCycles.Reset();
|
PlaneCycles.Reset();
|
||||||
MaskedCycles.Reset();
|
MaskedCycles.Reset();
|
||||||
WallScanCycles.Reset();
|
DrawerWaitCycles.Reset();
|
||||||
|
|
||||||
R_SetupFrame(MainThread()->Viewport->viewpoint, MainThread()->Viewport->viewwindow, actor);
|
R_SetupFrame(MainThread()->Viewport->viewpoint, MainThread()->Viewport->viewwindow, actor);
|
||||||
|
|
||||||
|
@ -179,7 +181,9 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
// Player sprites needs to be rendered after all the slices because they may be hardware accelerated.
|
// Player sprites needs to be rendered after all the slices because they may be hardware accelerated.
|
||||||
// If they are not hardware accelerated the drawers must run after all sliced drawers finished.
|
// If they are not hardware accelerated the drawers must run after all sliced drawers finished.
|
||||||
|
DrawerWaitCycles.Clock();
|
||||||
DrawerThreads::WaitForWorkers();
|
DrawerThreads::WaitForWorkers();
|
||||||
|
DrawerWaitCycles.Unclock();
|
||||||
MainThread()->DrawQueue->Clear();
|
MainThread()->DrawQueue->Clear();
|
||||||
MainThread()->PlayerSprites->Render();
|
MainThread()->PlayerSprites->Render();
|
||||||
DrawerThreads::Execute(MainThread()->DrawQueue);
|
DrawerThreads::Execute(MainThread()->DrawQueue);
|
||||||
|
@ -266,42 +270,24 @@ namespace swrenderer
|
||||||
if (thread->X2 < viewwidth)
|
if (thread->X2 < viewwidth)
|
||||||
thread->ClipSegments->Clip(thread->X2, viewwidth, true, &visitor);
|
thread->ClipSegments->Clip(thread->X2, viewwidth, true, &visitor);
|
||||||
|
|
||||||
if (thread->MainThread)
|
|
||||||
WallCycles.Clock();
|
|
||||||
|
|
||||||
thread->OpaquePass->RenderScene();
|
thread->OpaquePass->RenderScene();
|
||||||
thread->Clip3D->ResetClip(); // reset clips (floor/ceiling)
|
thread->Clip3D->ResetClip(); // reset clips (floor/ceiling)
|
||||||
|
|
||||||
if (thread == MainThread())
|
|
||||||
WallCycles.Unclock();
|
|
||||||
|
|
||||||
if (thread->MainThread)
|
if (thread->MainThread)
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
if (viewactive)
|
if (viewactive)
|
||||||
{
|
{
|
||||||
if (thread->MainThread)
|
|
||||||
PlaneCycles.Clock();
|
|
||||||
|
|
||||||
thread->PlaneList->Render();
|
thread->PlaneList->Render();
|
||||||
|
|
||||||
thread->Portal->RenderPlanePortals();
|
thread->Portal->RenderPlanePortals();
|
||||||
|
|
||||||
if (thread->MainThread)
|
|
||||||
PlaneCycles.Unclock();
|
|
||||||
|
|
||||||
thread->Portal->RenderLinePortals();
|
thread->Portal->RenderLinePortals();
|
||||||
|
|
||||||
if (thread->MainThread)
|
if (thread->MainThread)
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
if (thread->MainThread)
|
|
||||||
MaskedCycles.Clock();
|
|
||||||
|
|
||||||
thread->TranslucentPass->Render();
|
thread->TranslucentPass->Render();
|
||||||
|
|
||||||
if (thread->MainThread)
|
|
||||||
MaskedCycles.Unclock();
|
|
||||||
|
|
||||||
if (thread->MainThread)
|
if (thread->MainThread)
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
}
|
}
|
||||||
|
@ -373,7 +359,9 @@ namespace swrenderer
|
||||||
viewport->SetViewport(MainThread(), width, height, MainThread()->Viewport->viewwindow.WidescreenRatio);
|
viewport->SetViewport(MainThread(), width, height, MainThread()->Viewport->viewwindow.WidescreenRatio);
|
||||||
|
|
||||||
RenderActorView(actor, dontmaplines);
|
RenderActorView(actor, dontmaplines);
|
||||||
|
DrawerWaitCycles.Clock();
|
||||||
DrawerThreads::WaitForWorkers();
|
DrawerThreads::WaitForWorkers();
|
||||||
|
DrawerWaitCycles.Unclock();
|
||||||
|
|
||||||
viewport->RenderTarget = screen;
|
viewport->RenderTarget = screen;
|
||||||
|
|
||||||
|
@ -419,12 +407,12 @@ namespace swrenderer
|
||||||
ADD_STAT(fps)
|
ADD_STAT(fps)
|
||||||
{
|
{
|
||||||
FString out;
|
FString out;
|
||||||
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms",
|
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms drawers=%04.1f ms",
|
||||||
FrameCycles.TimeMS(), WallCycles.TimeMS(), PlaneCycles.TimeMS(), MaskedCycles.TimeMS());
|
FrameCycles.TimeMS(), WallCycles.TimeMS(), PlaneCycles.TimeMS(), MaskedCycles.TimeMS(), DrawerWaitCycles.TimeMS());
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double f_acc, w_acc, p_acc, m_acc;
|
static double f_acc, w_acc, p_acc, m_acc, drawer_acc;
|
||||||
static int acc_c;
|
static int acc_c;
|
||||||
|
|
||||||
ADD_STAT(fps_accumulated)
|
ADD_STAT(fps_accumulated)
|
||||||
|
@ -433,10 +421,11 @@ namespace swrenderer
|
||||||
w_acc += WallCycles.TimeMS();
|
w_acc += WallCycles.TimeMS();
|
||||||
p_acc += PlaneCycles.TimeMS();
|
p_acc += PlaneCycles.TimeMS();
|
||||||
m_acc += MaskedCycles.TimeMS();
|
m_acc += MaskedCycles.TimeMS();
|
||||||
|
drawer_acc += DrawerWaitCycles.TimeMS();
|
||||||
acc_c++;
|
acc_c++;
|
||||||
FString out;
|
FString out;
|
||||||
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms %d counts",
|
out.Format("frame=%04.1f ms walls=%04.1f ms planes=%04.1f ms masked=%04.1f ms drawers=%04.1f ms %d counts",
|
||||||
f_acc / acc_c, w_acc / acc_c, p_acc / acc_c, m_acc / acc_c, acc_c);
|
f_acc / acc_c, w_acc / acc_c, p_acc / acc_c, m_acc / acc_c, drawer_acc / acc_c, acc_c);
|
||||||
Printf(PRINT_LOG, "%s\n", out.GetChars());
|
Printf(PRINT_LOG, "%s\n", out.GetChars());
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -457,24 +446,4 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
bestwallcycles = HUGE_VAL;
|
bestwallcycles = HUGE_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// The replacement code for Build's wallscan doesn't have any timing calls so this does not work anymore.
|
|
||||||
static double bestscancycles = HUGE_VAL;
|
|
||||||
|
|
||||||
ADD_STAT(scancycles)
|
|
||||||
{
|
|
||||||
FString out;
|
|
||||||
double scancycles = WallScanCycles.Time();
|
|
||||||
if (scancycles && scancycles < bestscancycles)
|
|
||||||
bestscancycles = scancycles;
|
|
||||||
out.Format("%g", bestscancycles);
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
CCMD(clearscancycles)
|
|
||||||
{
|
|
||||||
bestscancycles = HUGE_VAL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ extern cycle_t FrameCycles;
|
||||||
|
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, DrawerWaitCycles;
|
||||||
|
|
||||||
class RenderThread;
|
class RenderThread;
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,9 @@ namespace swrenderer
|
||||||
|
|
||||||
void RenderTranslucentPass::Render()
|
void RenderTranslucentPass::Render()
|
||||||
{
|
{
|
||||||
|
if (Thread->MainThread)
|
||||||
|
MaskedCycles.Clock();
|
||||||
|
|
||||||
CollectPortals();
|
CollectPortals();
|
||||||
Thread->SpriteList->Sort();
|
Thread->SpriteList->Sort();
|
||||||
Thread->DrawSegments->BuildSegmentGroups();
|
Thread->DrawSegments->BuildSegmentGroups();
|
||||||
|
@ -223,5 +226,8 @@ namespace swrenderer
|
||||||
clip3d->DeleteHeights();
|
clip3d->DeleteHeights();
|
||||||
clip3d->fake3D = 0;
|
clip3d->fake3D = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Thread->MainThread)
|
||||||
|
MaskedCycles.Unclock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue