Mesa (softpipe-opt): progs/demos: add fps output to cubemap

Keith Whitwell keithw at kemper.freedesktop.org
Mon Aug 24 07:48:42 UTC 2009


Module: Mesa
Branch: softpipe-opt
Commit: 75312b655567695359063dcf3c28aa48433c575b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=75312b655567695359063dcf3c28aa48433c575b

Author: Keith Whitwell <keithw at vmware.com>
Date:   Sun Aug 23 19:02:17 2009 +0100

progs/demos: add fps output to cubemap

---

 progs/demos/cubemap.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/progs/demos/cubemap.c b/progs/demos/cubemap.c
index 1f9f290..0a3e10d 100644
--- a/progs/demos/cubemap.c
+++ b/progs/demos/cubemap.c
@@ -53,6 +53,8 @@ static GLint FrameParity = 0;
 static GLenum FilterIndex = 0;
 static GLint ClampIndex = 0;
 static GLboolean supportFBO = GL_FALSE;
+static GLint T0 = 0;
+static GLint Frames = 0;
 
 
 static struct {
@@ -268,6 +270,20 @@ static void draw( void )
    glPopMatrix();
 
    glutSwapBuffers();
+
+   Frames++;
+
+   {
+      GLint t = glutGet(GLUT_ELAPSED_TIME);
+      if (t - T0 >= 5000) {
+	 GLfloat seconds = (t - T0) / 1000.0;
+	 GLfloat fps = Frames / seconds;
+	 printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
+	 fflush(stdout);
+	 T0 = t;
+	 Frames = 0;
+      }
+   }
 }
 
 




More information about the mesa-commit mailing list