switch vector types

add average-FPS-during-this-screen; i'm using it for benchmarking
This commit is contained in:
Glenn Maynard
2003-01-11 05:12:17 +00:00
parent 992ff34784
commit 82a4960bd9
3 changed files with 18 additions and 11 deletions
+15 -6
View File
@@ -33,7 +33,7 @@ int g_flags = 0; /* SDL video flags */
GLenum g_vertMode = GL_TRIANGLES; GLenum g_vertMode = GL_TRIANGLES;
RageTimer g_LastCheckTimer; RageTimer g_LastCheckTimer;
int g_iNumVerts; int g_iNumVerts;
int g_iFPS, g_iVPF; int g_iFPS, g_iVPF, g_iCFPS;
int g_PerspectiveMode = 0; int g_PerspectiveMode = 0;
@@ -41,13 +41,18 @@ int g_CurrentHeight, g_CurrentWidth, g_CurrentBPP;
int g_ModelMatrixCnt=0; int g_ModelMatrixCnt=0;
int RageDisplay::GetFPS() const { return g_iFPS; } int RageDisplay::GetFPS() const { return g_iFPS; }
int RageDisplay::GetVPF() const { return g_iVPF; } int RageDisplay::GetVPF() const { return g_iVPF; }
int RageDisplay::GetCumFPS() const { return g_iCFPS; }
static int g_iFramesRenderedSinceLastCheck, static int g_iFramesRenderedSinceLastCheck,
g_iVertsRenderedSinceLastCheck; g_iFramesRenderedSinceLastReset,
g_iVertsRenderedSinceLastCheck,
g_iNumChecksSinceLastReset;
PWSWAPINTERVALEXTPROC GLExt::wglSwapIntervalEXT; PWSWAPINTERVALEXTPROC GLExt::wglSwapIntervalEXT;
const GLenum RageVertexFormat = GL_T2F_C4UB_V3F; /* We don't actually use normals (we don't tunr on lighting), there's just
* no GL_T2F_C4F_V3F. */
const GLenum RageVertexFormat = GL_T2F_C4F_N3F_V3F;
void GetGLExtensions(set<string> &ext) void GetGLExtensions(set<string> &ext)
{ {
@@ -288,22 +293,26 @@ void RageDisplay::Flip()
{ {
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
g_iFramesRenderedSinceLastCheck++; g_iFramesRenderedSinceLastCheck++;
g_iFramesRenderedSinceLastReset++;
if( g_LastCheckTimer.PeekDeltaTime() >= 1.0f ) // update stats every 1 sec. if( g_LastCheckTimer.PeekDeltaTime() >= 1.0f ) // update stats every 1 sec.
{ {
g_LastCheckTimer.GetDeltaTime(); g_LastCheckTimer.GetDeltaTime();
g_iNumChecksSinceLastReset++;
g_iFPS = g_iFramesRenderedSinceLastCheck; g_iFPS = g_iFramesRenderedSinceLastCheck;
g_iCFPS = g_iFramesRenderedSinceLastReset / g_iNumChecksSinceLastReset;
g_iVPF = g_iVertsRenderedSinceLastCheck / g_iFPS; g_iVPF = g_iVertsRenderedSinceLastCheck / g_iFPS;
g_iFramesRenderedSinceLastCheck = g_iVertsRenderedSinceLastCheck = 0; g_iFramesRenderedSinceLastCheck = g_iVertsRenderedSinceLastCheck = 0;
LOG->Trace( "FPS: %d, VPF: %d", g_iFPS, g_iVPF ); LOG->Trace( "FPS: %d, CFPS %d, VPF: %d", g_iFPS, g_iCFPS, g_iVPF );
} }
} }
void RageDisplay::ResetStats() void RageDisplay::ResetStats()
{ {
g_iFPS = g_iVPF = 0; g_iFPS = g_iVPF = 0;
g_iFramesRenderedSinceLastCheck = g_iVertsRenderedSinceLastCheck = 0; g_iFramesRenderedSinceLastCheck = g_iFramesRenderedSinceLastReset = 0;
g_iNumChecksSinceLastReset = 0;
g_iVertsRenderedSinceLastCheck = 0;
g_LastCheckTimer.GetDeltaTime(); g_LastCheckTimer.GetDeltaTime();
} }
+1
View File
@@ -79,6 +79,7 @@ public:
/* Statistics */ /* Statistics */
int GetFPS() const; int GetFPS() const;
int GetVPF() const; int GetVPF() const;
int GetCumFPS() const; /* average FPS since last reset */
void ResetStats(); void ResetStats();
const oglspecs_t &GetSpecs() const { return *m_oglspecs; } const oglspecs_t &GetSpecs() const { return *m_oglspecs; }
+2 -5
View File
@@ -180,15 +180,12 @@ typedef Rect<float> RectF;
// A structure for our custom vertex type. Note that these data structes have the same layout that D3D expects. // A structure for our custom vertex type. Note that these data structes have the same layout that D3D expects.
struct RageVertex struct RageVertex
{ {
// This is the format expected by OpenGL. D3D expects the reverse!
RageVector2 t; // texture coordinates RageVector2 t; // texture coordinates
RageVColor c; // diffuse color RageColor c; // diffuse color
RageVector3 n; // normal
RageVector3 p; // position RageVector3 p; // position
}; };
#define D3DFVF_RAGEVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) // D3D FVF flags which describe our vertex structure
/* nonstandard extension used : nameless struct/union /* nonstandard extension used : nameless struct/union
* It is, in fact, nonstandard. G++ 3.x can handle it. 2.95.x can not. XXX */ * It is, in fact, nonstandard. G++ 3.x can handle it. 2.95.x can not. XXX */
#if defined(_MSC_VER) #if defined(_MSC_VER)