mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- fixed portal benchmarking and added separate output for 2D and finishing the main scene.
This commit is contained in:
parent
8a6ae503be
commit
8f96729e06
6 changed files with 53 additions and 22 deletions
|
@ -36,6 +36,7 @@
|
|||
#include "d_player.h"
|
||||
#include "a_dynlight.h"
|
||||
#include "swrenderer/r_swscene.h"
|
||||
#include "hwrenderer/utility/hw_clock.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
|
@ -463,6 +464,7 @@ CVAR(Bool, gl_aalines, false, CVAR_ARCHIVE)
|
|||
|
||||
void FGLRenderer::Draw2D(F2DDrawer *drawer)
|
||||
{
|
||||
twoD.Clock();
|
||||
if (buffersActive)
|
||||
{
|
||||
mBuffers->BindCurrentFB();
|
||||
|
@ -491,7 +493,11 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
|
|||
auto &indices = drawer->mIndices;
|
||||
auto &commands = drawer->mData;
|
||||
|
||||
if (commands.Size() == 0) return;
|
||||
if (commands.Size() == 0)
|
||||
{
|
||||
twoD.Unclock();
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto &v : vertices)
|
||||
{
|
||||
|
@ -633,4 +639,5 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
|
|||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.Apply();
|
||||
delete vb;
|
||||
twoD.Unclock();
|
||||
}
|
||||
|
|
|
@ -163,12 +163,11 @@ void GLPortal::DrawPortalStencil()
|
|||
bool GLPortal::Start(bool usestencil, bool doquery)
|
||||
{
|
||||
rendered_portals++;
|
||||
// PortalAll.Clock();
|
||||
Clocker c(PortalAll);
|
||||
if (usestencil)
|
||||
{
|
||||
if (!gl_portals)
|
||||
{
|
||||
// PortalAll.Unclock();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -226,7 +225,6 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
// restore default stencil op.
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
glStencilFunc(GL_EQUAL, recursion, ~0); // draw sky into stencil
|
||||
PortalAll.Unclock();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +283,6 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
GLRenderer->mCurrentPortal = this;
|
||||
|
||||
if (PrevPortal != NULL) PrevPortal->PushState();
|
||||
// PortalAll.Unclock();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -326,7 +323,7 @@ void GLPortal::End(bool usestencil)
|
|||
{
|
||||
bool needdepth = NeedDepthBuffer();
|
||||
|
||||
PortalAll.Clock();
|
||||
Clocker c(PortalAll);
|
||||
if (PrevPortal != NULL) PrevPortal->PopState();
|
||||
GLRenderer->mCurrentPortal = PrevPortal;
|
||||
GLRenderer->mClipPortal = PrevClipPortal;
|
||||
|
@ -425,7 +422,6 @@ void GLPortal::End(bool usestencil)
|
|||
}
|
||||
glDepthFunc(GL_LESS);
|
||||
}
|
||||
PortalAll.Unclock();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1151,7 +1147,7 @@ GLHorizonPortal::GLHorizonPortal(GLHorizonInfo * pt, bool local)
|
|||
//-----------------------------------------------------------------------------
|
||||
void GLHorizonPortal::DrawContents()
|
||||
{
|
||||
PortalAll.Clock();
|
||||
Clocker c(PortalAll);
|
||||
|
||||
FMaterial * gltexture;
|
||||
PalEntry color;
|
||||
|
@ -1162,7 +1158,6 @@ void GLHorizonPortal::DrawContents()
|
|||
if (!gltexture)
|
||||
{
|
||||
ClearScreen();
|
||||
PortalAll.Unclock();
|
||||
return;
|
||||
}
|
||||
gl_RenderState.SetCameraPos(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z);
|
||||
|
@ -1198,8 +1193,6 @@ void GLHorizonPortal::DrawContents()
|
|||
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_STRIP, voffset + vcount, 10);
|
||||
|
||||
gl_RenderState.EnableTextureMatrix(false);
|
||||
PortalAll.Unclock();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1225,7 +1218,6 @@ void GLHorizonPortal::DrawContents()
|
|||
|
||||
void GLEEHorizonPortal::DrawContents()
|
||||
{
|
||||
PortalAll.Clock();
|
||||
sector_t *sector = portal->mOrigin;
|
||||
if (sector->GetTexture(sector_t::floor) == skyflatnum ||
|
||||
sector->GetTexture(sector_t::ceiling) == skyflatnum)
|
||||
|
@ -1263,9 +1255,6 @@ void GLEEHorizonPortal::DrawContents()
|
|||
GLHorizonPortal floor(&horz, true);
|
||||
floor.DrawContents();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GLPortal::Initialize()
|
||||
|
|
|
@ -149,8 +149,13 @@ void OpenGLFrameBuffer::InitializeState()
|
|||
|
||||
void OpenGLFrameBuffer::Update()
|
||||
{
|
||||
twoD.Reset();
|
||||
Flush3D.Reset();
|
||||
|
||||
DrawRateStuff();
|
||||
Flush3D.Clock();
|
||||
GLRenderer->Flush();
|
||||
Flush3D.Unclock();
|
||||
|
||||
Swap();
|
||||
CheckBench();
|
||||
|
@ -244,7 +249,7 @@ uint32_t OpenGLFrameBuffer::GetCaps()
|
|||
// legacy mode always has truecolor because palette tonemap is not available
|
||||
FlagSet |= RFF_TRUECOLOR;
|
||||
}
|
||||
else if (!(FGLRenderBuffers::IsEnabled()))
|
||||
else if (!RenderBuffersEnabled())
|
||||
{
|
||||
// truecolor is always available when renderbuffers are unavailable because palette tonemap is not possible
|
||||
FlagSet |= RFF_TRUECOLOR | RFF_MATSHADER | RFF_BRIGHTMAP;
|
||||
|
|
|
@ -50,6 +50,7 @@ glcycle_t ProcessAll;
|
|||
glcycle_t RenderAll;
|
||||
glcycle_t Dirty;
|
||||
glcycle_t drawcalls;
|
||||
glcycle_t twoD, Flush3D;
|
||||
int vertexcount, flatvertices, flatprimitives;
|
||||
|
||||
int rendered_lines,rendered_flats,rendered_sprites,render_vertexsplit,render_texsplit,rendered_decals, rendered_portals;
|
||||
|
@ -88,13 +89,18 @@ static void AppendRenderTimes(FString &str)
|
|||
double clipwall = ClipWall.TimeMS() - SetupWall.TimeMS();
|
||||
double bsp = Bsp.TimeMS() - ClipWall.TimeMS() - SetupFlat.TimeMS() - SetupSprite.TimeMS();
|
||||
|
||||
str.AppendFormat("W: Render=%2.3f, Setup=%2.3f, Clip=%2.3f\n"
|
||||
str.AppendFormat("BSP = %2.3f, Clip=%2.3f\n"
|
||||
"W: Render=%2.3f, Setup=%2.3f\n"
|
||||
"F: Render=%2.3f, Setup=%2.3f\n"
|
||||
"S: Render=%2.3f, Setup=%2.3f\n"
|
||||
"All=%2.3f, Render=%2.3f, Setup=%2.3f, BSP = %2.3f, Portal=%2.3f, Drawcalls=%2.3f, Finish=%2.3f\n",
|
||||
RenderWall.TimeMS(), setupwall, clipwall, RenderFlat.TimeMS(), SetupFlat.TimeMS(),
|
||||
RenderSprite.TimeMS(), SetupSprite.TimeMS(), All.TimeMS() + Finish.TimeMS(), RenderAll.TimeMS(),
|
||||
ProcessAll.TimeMS(), bsp, PortalAll.TimeMS(), drawcalls.TimeMS(), Finish.TimeMS());
|
||||
"2D: %2.3f Finish3D: %2.3f\n"
|
||||
"All=%2.3f, Render=%2.3f, Setup=%2.3f, Portal=%2.3f, Drawcalls=%2.3f, Finish=%2.3f\n",
|
||||
bsp, clipwall,
|
||||
RenderWall.TimeMS(), setupwall,
|
||||
RenderFlat.TimeMS(), SetupFlat.TimeMS(),
|
||||
RenderSprite.TimeMS(), SetupSprite.TimeMS(),
|
||||
twoD.TimeMS(), Flush3D.TimeMS() - twoD.TimeMS(),
|
||||
All.TimeMS() + Finish.TimeMS(), RenderAll.TimeMS(), ProcessAll.TimeMS(), PortalAll.TimeMS(), drawcalls.TimeMS(), Finish.TimeMS());
|
||||
}
|
||||
|
||||
static void AppendRenderStats(FString &out)
|
||||
|
|
|
@ -12,7 +12,7 @@ extern glcycle_t All, Finish, PortalAll, Bsp;
|
|||
extern glcycle_t ProcessAll;
|
||||
extern glcycle_t RenderAll;
|
||||
extern glcycle_t Dirty;
|
||||
extern glcycle_t drawcalls;
|
||||
extern glcycle_t drawcalls, twoD, Flush3D;
|
||||
|
||||
extern int iter_dlightf, iter_dlight, draw_dlight, draw_dlightf;
|
||||
extern int rendered_lines,rendered_flats,rendered_sprites,rendered_decals,render_vertexsplit,render_texsplit;
|
||||
|
|
24
src/stats.h
24
src/stats.h
|
@ -212,6 +212,30 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// Helper for code that uses a timer and has multiple exit points.
|
||||
class Clocker
|
||||
{
|
||||
public:
|
||||
|
||||
explicit Clocker(glcycle_t& clck)
|
||||
: clock(clck)
|
||||
{
|
||||
clock.Clock();
|
||||
}
|
||||
|
||||
~Clocker()
|
||||
{ // unlock
|
||||
clock.Unclock();
|
||||
}
|
||||
|
||||
Clocker(const Clocker&) = delete;
|
||||
Clocker& operator=(const Clocker&) = delete;
|
||||
private:
|
||||
glcycle_t & clock;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class FStat
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue