mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 23:32:04 +00:00
Reorder scene setup to do the stuff that can't be threaded first
This commit is contained in:
parent
5bae06a3c6
commit
f50532af8a
2 changed files with 27 additions and 26 deletions
|
@ -51,6 +51,8 @@ namespace swrenderer
|
||||||
~RenderThread();
|
~RenderThread();
|
||||||
|
|
||||||
RenderScene *Scene;
|
RenderScene *Scene;
|
||||||
|
int X1 = 0;
|
||||||
|
int X2 = MAXWIDTH;
|
||||||
|
|
||||||
std::unique_ptr<RenderMemory> FrameMemory;
|
std::unique_ptr<RenderMemory> FrameMemory;
|
||||||
std::unique_ptr<RenderOpaquePass> OpaquePass;
|
std::unique_ptr<RenderOpaquePass> OpaquePass;
|
||||||
|
|
|
@ -111,51 +111,48 @@ namespace swrenderer
|
||||||
MaskedCycles.Reset();
|
MaskedCycles.Reset();
|
||||||
WallScanCycles.Reset();
|
WallScanCycles.Reset();
|
||||||
|
|
||||||
MainThread()->FrameMemory->Clear();
|
|
||||||
|
|
||||||
Clip3DFloors *clip3d = MainThread()->Clip3DFloors.get();
|
|
||||||
clip3d->Cleanup();
|
|
||||||
clip3d->ResetClip(); // reset clips (floor/ceiling)
|
|
||||||
|
|
||||||
R_SetupFrame(actor);
|
R_SetupFrame(actor);
|
||||||
CameraLight::Instance()->SetCamera(actor);
|
CameraLight::Instance()->SetCamera(actor);
|
||||||
RenderViewport::Instance()->SetupFreelook();
|
RenderViewport::Instance()->SetupFreelook();
|
||||||
|
|
||||||
MainThread()->Portal->CopyStackedViewParameters();
|
|
||||||
|
|
||||||
// Clear buffers.
|
|
||||||
MainThread()->ClipSegments->Clear(0, viewwidth);
|
|
||||||
MainThread()->DrawSegments->Clear();
|
|
||||||
MainThread()->PlaneList->Clear();
|
|
||||||
MainThread()->TranslucentPass->Clear();
|
|
||||||
|
|
||||||
// opening / clipping determination
|
|
||||||
MainThread()->OpaquePass->ClearClip();
|
|
||||||
|
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
|
||||||
MainThread()->Portal->SetMainPortal();
|
|
||||||
|
|
||||||
this->dontmaplines = dontmaplines;
|
this->dontmaplines = dontmaplines;
|
||||||
|
|
||||||
// [RH] Hack to make windows into underwater areas possible
|
|
||||||
MainThread()->OpaquePass->ResetFakingUnderwater();
|
|
||||||
|
|
||||||
// [RH] Setup particles for this frame
|
// [RH] Setup particles for this frame
|
||||||
P_FindParticleSubsectors();
|
P_FindParticleSubsectors();
|
||||||
|
|
||||||
WallCycles.Clock();
|
// Link the polyobjects right before drawing the scene to reduce the amounts of calls to this function
|
||||||
|
PO_LinkToSubsectors();
|
||||||
|
|
||||||
ActorRenderFlags savedflags = camera->renderflags;
|
ActorRenderFlags savedflags = camera->renderflags;
|
||||||
// Never draw the player unless in chasecam mode
|
// Never draw the player unless in chasecam mode
|
||||||
if (!r_showviewer)
|
if (!r_showviewer)
|
||||||
{
|
{
|
||||||
camera->renderflags |= RF_INVISIBLE;
|
camera->renderflags |= RF_INVISIBLE;
|
||||||
}
|
}
|
||||||
// Link the polyobjects right before drawing the scene to reduce the amounts of calls to this function
|
|
||||||
PO_LinkToSubsectors();
|
MainThread()->FrameMemory->Clear();
|
||||||
|
MainThread()->Clip3DFloors->Cleanup();
|
||||||
|
MainThread()->Clip3DFloors->ResetClip(); // reset clips (floor/ceiling)
|
||||||
|
MainThread()->Portal->CopyStackedViewParameters();
|
||||||
|
MainThread()->ClipSegments->Clear(0, viewwidth);
|
||||||
|
MainThread()->DrawSegments->Clear();
|
||||||
|
MainThread()->PlaneList->Clear();
|
||||||
|
MainThread()->TranslucentPass->Clear();
|
||||||
|
MainThread()->OpaquePass->ClearClip();
|
||||||
|
MainThread()->OpaquePass->ResetFakingUnderwater(); // [RH] Hack to make windows into underwater areas possible
|
||||||
|
MainThread()->Portal->SetMainPortal();
|
||||||
|
|
||||||
|
// Cull things outside the range seen by this thread
|
||||||
|
if (MainThread()->X1 > 0)
|
||||||
|
MainThread()->ClipSegments->Clip(0, MainThread()->X1, true, [](int, int) { return true; });
|
||||||
|
if (MainThread()->X2 < viewwidth)
|
||||||
|
MainThread()->ClipSegments->Clip(MainThread()->X2, viewwidth, true, [](int, int) { return true; });
|
||||||
|
|
||||||
|
WallCycles.Clock();
|
||||||
MainThread()->OpaquePass->RenderScene();
|
MainThread()->OpaquePass->RenderScene();
|
||||||
MainThread()->Clip3DFloors->ResetClip(); // reset clips (floor/ceiling)
|
MainThread()->Clip3DFloors->ResetClip(); // reset clips (floor/ceiling)
|
||||||
camera->renderflags = savedflags;
|
|
||||||
WallCycles.Unclock();
|
WallCycles.Unclock();
|
||||||
|
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
@ -177,6 +174,8 @@ namespace swrenderer
|
||||||
|
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
camera->renderflags = savedflags;
|
||||||
interpolator.RestoreInterpolations();
|
interpolator.RestoreInterpolations();
|
||||||
|
|
||||||
// If we don't want shadered colormaps, NULL it now so that the
|
// If we don't want shadered colormaps, NULL it now so that the
|
||||||
|
|
Loading…
Reference in a new issue