mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- added benchmarking calls for glDrawArrays to see how well issunig draw calls performs on different hardware.
This commit is contained in:
parent
0ce6b40672
commit
5b302ed3a6
5 changed files with 15 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
|||
#define __VERTEXBUFFER_H
|
||||
|
||||
#include "tarray.h"
|
||||
#include "gl/utility/gl_clock.h"
|
||||
|
||||
struct vertex_t;
|
||||
struct secplane_t;
|
||||
|
@ -74,11 +75,15 @@ public:
|
|||
return diff;
|
||||
}
|
||||
#ifdef __GL_PCH_H // we need the system includes for this but we cannot include them ourselves without creating #define clashes. The affected files wouldn't try to draw anyway.
|
||||
void RenderCurrent(FFlatVertex *newptr, unsigned int primtype)
|
||||
void RenderCurrent(FFlatVertex *newptr, unsigned int primtype, unsigned int *poffset = NULL, unsigned int *pcount = NULL)
|
||||
{
|
||||
unsigned int offset;
|
||||
unsigned int count = GetCount(newptr, &offset);
|
||||
drawcalls.Clock();
|
||||
glDrawArrays(primtype, offset, count);
|
||||
drawcalls.Unclock();
|
||||
if (poffset) *poffset = offset;
|
||||
if (pcount) *pcount = count;
|
||||
}
|
||||
#endif
|
||||
void Reset()
|
||||
|
@ -135,7 +140,7 @@ private:
|
|||
void SkyVertex(int r, int c, bool yflip);
|
||||
void CreateSkyHemisphere(int hemi);
|
||||
void CreateDome();
|
||||
void RenderRow(int prim, int row, bool color);
|
||||
void RenderRow(int prim, int row);
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -332,7 +332,9 @@ void GLFlat::DrawSubsectors(int pass, bool istrans)
|
|||
if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans)
|
||||
{
|
||||
if (pass == GLPASS_ALL) lightsapplied = SetupSubsectorLights(lightsapplied, sub);
|
||||
drawcalls.Clock();
|
||||
glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines);
|
||||
drawcalls.Unclock();
|
||||
flatvertices += sub->numlines;
|
||||
flatprimitives++;
|
||||
}
|
||||
|
|
|
@ -300,8 +300,7 @@ void GLSprite::Draw(int pass)
|
|||
ptr++;
|
||||
ptr->Set(v4[0], v4[1], v4[2], ur, vb);
|
||||
ptr++;
|
||||
count = GLRenderer->mVBO->GetCount(ptr, &offset);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, offset, count);
|
||||
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP, &offset, &count);
|
||||
}
|
||||
|
||||
if (foglayer)
|
||||
|
|
|
@ -23,6 +23,7 @@ glcycle_t All, Finish, PortalAll, Bsp;
|
|||
glcycle_t ProcessAll;
|
||||
glcycle_t RenderAll;
|
||||
glcycle_t Dirty;
|
||||
glcycle_t drawcalls;
|
||||
int vertexcount, flatvertices, flatprimitives;
|
||||
|
||||
int rendered_lines,rendered_flats,rendered_sprites,render_vertexsplit,render_texsplit,rendered_decals, rendered_portals;
|
||||
|
@ -96,6 +97,7 @@ void ResetProfilingData()
|
|||
SetupFlat.Reset();
|
||||
RenderSprite.Reset();
|
||||
SetupSprite.Reset();
|
||||
drawcalls.Reset();
|
||||
|
||||
flatvertices=flatprimitives=vertexcount=0;
|
||||
render_texsplit=render_vertexsplit=rendered_lines=rendered_flats=rendered_sprites=rendered_decals=rendered_portals = 0;
|
||||
|
@ -116,10 +118,10 @@ static void AppendRenderTimes(FString &str)
|
|||
str.AppendFormat("W: Render=%2.3f, Split = %2.3f, Setup=%2.3f, Clip=%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, Finish=%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(), SplitWall.TimeMS(), setupwall, clipwall, RenderFlat.TimeMS(), SetupFlat.TimeMS(),
|
||||
RenderSprite.TimeMS(), SetupSprite.TimeMS(), All.TimeMS() + Finish.TimeMS(), RenderAll.TimeMS(),
|
||||
ProcessAll.TimeMS(), bsp, PortalAll.TimeMS(), Finish.TimeMS());
|
||||
ProcessAll.TimeMS(), bsp, PortalAll.TimeMS(), drawcalls.TimeMS(), Finish.TimeMS());
|
||||
}
|
||||
|
||||
static void AppendRenderStats(FString &out)
|
||||
|
|
|
@ -108,6 +108,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 int iter_dlightf, iter_dlight, draw_dlight, draw_dlightf;
|
||||
extern int rendered_lines,rendered_flats,rendered_sprites,rendered_decals,render_vertexsplit,render_texsplit;
|
||||
|
|
Loading…
Reference in a new issue