mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
Sanitized the Being/End2D interface so that it can be used to keep the attribute buffer mapped while processing 2D commands.
For this to work the 2D mode has to be properly set and unset at the right places so that no double mapping occurs and no render operation can happen while in 2D mode. # Conflicts: # src/d_main.cpp # src/v_video.h
This commit is contained in:
parent
2d1043d1d3
commit
ecf6e3f620
4 changed files with 102 additions and 108 deletions
|
@ -734,30 +734,13 @@ void D_Display ()
|
||||||
wipe = false;
|
wipe = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
screen->FrameTime = I_msTimeFS();
|
screen->FrameTime = I_msTimeFS();
|
||||||
TexMan.UpdateAnimations(screen->FrameTime);
|
TexMan.UpdateAnimations(screen->FrameTime);
|
||||||
R_UpdateSky(screen->FrameTime);
|
R_UpdateSky(screen->FrameTime);
|
||||||
screen->BeginFrame();
|
screen->BeginFrame();
|
||||||
screen->ClearClipRect();
|
screen->ClearClipRect();
|
||||||
switch (gamestate)
|
if ((gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL) && gametic != 0)
|
||||||
{
|
{
|
||||||
case GS_FULLCONSOLE:
|
|
||||||
screen->Begin2D(false);
|
|
||||||
C_DrawConsole ();
|
|
||||||
M_Drawer ();
|
|
||||||
screen->End2D();
|
|
||||||
screen->Update ();
|
|
||||||
return;
|
|
||||||
|
|
||||||
case GS_LEVEL:
|
|
||||||
case GS_TITLELEVEL:
|
|
||||||
if (!gametic)
|
|
||||||
{
|
|
||||||
screen->Begin2D(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// [ZZ] execute event hook that we just started the frame
|
// [ZZ] execute event hook that we just started the frame
|
||||||
//E_RenderFrame();
|
//E_RenderFrame();
|
||||||
//
|
//
|
||||||
|
@ -771,9 +754,8 @@ void D_Display ()
|
||||||
else level.HasDynamicLights = false; // lights are off so effectively we have none.
|
else level.HasDynamicLights = false; // lights are off so effectively we have none.
|
||||||
|
|
||||||
viewsec = screen->RenderView(&players[consoleplayer]);
|
viewsec = screen->RenderView(&players[consoleplayer]);
|
||||||
screen->Begin2D(false);
|
screen->Begin2D();
|
||||||
screen->DrawBlend(viewsec);
|
screen->DrawBlend(viewsec);
|
||||||
// returns with 2S mode set.
|
|
||||||
if (automapactive)
|
if (automapactive)
|
||||||
{
|
{
|
||||||
AM_Drawer (hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
|
AM_Drawer (hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
|
||||||
|
@ -798,8 +780,7 @@ void D_Display ()
|
||||||
StatusBar->CallDraw (HUD_AltHud, vp.TicFrac);
|
StatusBar->CallDraw (HUD_AltHud, vp.TicFrac);
|
||||||
StatusBar->DrawTopStuff (HUD_AltHud);
|
StatusBar->DrawTopStuff (HUD_AltHud);
|
||||||
}
|
}
|
||||||
else
|
else if (viewheight == SCREENHEIGHT && viewactive && screenblocks > 10)
|
||||||
if (viewheight == SCREENHEIGHT && viewactive && screenblocks > 10)
|
|
||||||
{
|
{
|
||||||
EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None;
|
EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None;
|
||||||
StatusBar->DrawBottomStuff (state);
|
StatusBar->DrawBottomStuff (state);
|
||||||
|
@ -814,31 +795,37 @@ void D_Display ()
|
||||||
}
|
}
|
||||||
//stb.Unclock();
|
//stb.Unclock();
|
||||||
//Printf("Stbar = %f\n", stb.TimeMS());
|
//Printf("Stbar = %f\n", stb.TimeMS());
|
||||||
CT_Drawer ();
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
screen->Begin2D();
|
||||||
|
switch (gamestate)
|
||||||
|
{
|
||||||
|
case GS_FULLCONSOLE:
|
||||||
|
screen->Begin2D();
|
||||||
|
C_DrawConsole ();
|
||||||
|
M_Drawer ();
|
||||||
|
screen->End2DAndUpdate ();
|
||||||
|
return;
|
||||||
|
|
||||||
case GS_INTERMISSION:
|
case GS_INTERMISSION:
|
||||||
screen->Begin2D(false);
|
|
||||||
WI_Drawer ();
|
WI_Drawer ();
|
||||||
CT_Drawer ();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_FINALE:
|
case GS_FINALE:
|
||||||
screen->Begin2D(false);
|
|
||||||
F_Drawer ();
|
F_Drawer ();
|
||||||
CT_Drawer ();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_DEMOSCREEN:
|
case GS_DEMOSCREEN:
|
||||||
screen->Begin2D(false);
|
|
||||||
D_PageDrawer ();
|
D_PageDrawer ();
|
||||||
CT_Drawer ();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CT_Drawer ();
|
||||||
|
|
||||||
// draw pause pic
|
// draw pause pic
|
||||||
if ((paused || pauseext) && menuactive == MENU_Off)
|
if ((paused || pauseext) && menuactive == MENU_Off)
|
||||||
{
|
{
|
||||||
|
@ -887,7 +874,7 @@ void D_Display ()
|
||||||
C_DrawConsole (); // draw console
|
C_DrawConsole (); // draw console
|
||||||
M_Drawer (); // menu is drawn even on top of everything
|
M_Drawer (); // menu is drawn even on top of everything
|
||||||
FStat::PrintStat ();
|
FStat::PrintStat ();
|
||||||
screen->Update (); // page flip or blit buffer
|
screen->End2DAndUpdate ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -897,6 +884,7 @@ void D_Display ()
|
||||||
|
|
||||||
GSnd->SetSfxPaused(true, 1);
|
GSnd->SetSfxPaused(true, 1);
|
||||||
I_FreezeTime(true);
|
I_FreezeTime(true);
|
||||||
|
screen->End2D();
|
||||||
screen->WipeEndScreen ();
|
screen->WipeEndScreen ();
|
||||||
|
|
||||||
wipestart = I_msTime();
|
wipestart = I_msTime();
|
||||||
|
@ -912,16 +900,16 @@ void D_Display ()
|
||||||
} while (diff < 1);
|
} while (diff < 1);
|
||||||
wipestart = nowtime;
|
wipestart = nowtime;
|
||||||
done = screen->WipeDo (1);
|
done = screen->WipeDo (1);
|
||||||
|
screen->Begin2D();
|
||||||
C_DrawConsole (); // console and
|
C_DrawConsole (); // console and
|
||||||
M_Drawer (); // menu are drawn even on top of wipes
|
M_Drawer (); // menu are drawn even on top of wipes
|
||||||
screen->Update (); // page flip or blit buffer
|
screen->End2DAndUpdate ();
|
||||||
NetUpdate (); // [RH] not sure this is needed anymore
|
NetUpdate (); // [RH] not sure this is needed anymore
|
||||||
} while (!done);
|
} while (!done);
|
||||||
screen->WipeCleanup();
|
screen->WipeCleanup();
|
||||||
I_FreezeTime(false);
|
I_FreezeTime(false);
|
||||||
GSnd->SetSfxPaused(false, 1);
|
GSnd->SetSfxPaused(false, 1);
|
||||||
}
|
}
|
||||||
screen->End2D();
|
|
||||||
cycles.Unclock();
|
cycles.Unclock();
|
||||||
FrameCycles = cycles;
|
FrameCycles = cycles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,6 @@ void OpenGLFrameBuffer::Update()
|
||||||
twoD.Reset();
|
twoD.Reset();
|
||||||
Flush3D.Reset();
|
Flush3D.Reset();
|
||||||
|
|
||||||
DrawRateStuff();
|
|
||||||
Flush3D.Clock();
|
Flush3D.Clock();
|
||||||
GLRenderer->Flush();
|
GLRenderer->Flush();
|
||||||
Flush3D.Unclock();
|
Flush3D.Unclock();
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
~OpenGLFrameBuffer();
|
~OpenGLFrameBuffer();
|
||||||
|
|
||||||
void InitializeState();
|
void InitializeState();
|
||||||
void Update();
|
void Update() override;
|
||||||
|
|
||||||
// Color correction
|
// Color correction
|
||||||
void SetGamma();
|
void SetGamma();
|
||||||
|
|
|
@ -441,11 +441,18 @@ public:
|
||||||
virtual IUniformBuffer *CreateUniformBuffer(size_t size, bool staticuse = false) { return nullptr; }
|
virtual IUniformBuffer *CreateUniformBuffer(size_t size, bool staticuse = false) { return nullptr; }
|
||||||
virtual IShaderProgram *CreateShaderProgram() { return nullptr; }
|
virtual IShaderProgram *CreateShaderProgram() { return nullptr; }
|
||||||
|
|
||||||
// Begin 2D drawing operations.
|
// Begin/End 2D drawing operations.
|
||||||
// Returns true if hardware-accelerated 2D has been entered, false if not.
|
void Begin2D() { isIn2D = true; }
|
||||||
void Begin2D(bool copy3d) { isIn2D = true; }
|
|
||||||
void End2D() { isIn2D = false; }
|
void End2D() { isIn2D = false; }
|
||||||
|
|
||||||
|
void End2DAndUpdate()
|
||||||
|
{
|
||||||
|
DrawRateStuff();
|
||||||
|
End2D();
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns true if Begin2D has been called and 2D drawing is now active
|
// Returns true if Begin2D has been called and 2D drawing is now active
|
||||||
bool HasBegun2D() { return isIn2D; }
|
bool HasBegun2D() { return isIn2D; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue