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