diff options
author | Brian Paul <brianp@vmware.com> | 2009-09-22 09:53:35 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-09-22 09:53:35 -0600 |
commit | bae2d5882781f798001be6f7841c32a1f12046fe (patch) | |
tree | 2a1e99e7c0f2a928481316ccc83e4347a4bc3e3c /progs/perf/vbo.c | |
parent | 7e5004b298f7e6f87d659d314cac991bff7980cf (diff) |
progs/perf: add another VBO test for Create/Draw/Destroy pattern
Report both MB/sec and draw/sec.
Diffstat (limited to 'progs/perf/vbo.c')
-rw-r--r-- | progs/perf/vbo.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/progs/perf/vbo.c b/progs/perf/vbo.c index ab893315e7..a9d4102de9 100644 --- a/progs/perf/vbo.c +++ b/progs/perf/vbo.c @@ -41,7 +41,7 @@ static GLuint VBO; static GLsizei VBOSize = 0; static GLsizei SubSize = 0; -static GLubyte *VBOData = NULL; +static GLubyte *VBOData = NULL; /* array[DATA_SIZE] */ static const GLboolean DrawPoint = GL_TRUE; static const GLboolean BufferSubDataInHalves = GL_TRUE; @@ -107,6 +107,7 @@ UploadSubVBO(unsigned count) glFinish(); } + /* Do multiple small SubData uploads, then call DrawArrays. This may be a * fairer comparison to back-to-back BufferData calls: */ @@ -132,6 +133,31 @@ BatchUploadSubVBO(unsigned count) } +/** + * Test the sequence: + * create/load VBO + * draw + * destroy VBO + */ +static void +CreateDrawDestroyVBO(unsigned count) +{ + unsigned i; + for (i = 0; i < count; i++) { + GLuint vbo; + /* create/load */ + glGenBuffersARB(1, &vbo); + glBufferDataARB(GL_ARRAY_BUFFER, VBOSize, VBOData, GL_STREAM_DRAW_ARB); + /* draw */ + glVertexPointer(2, GL_FLOAT, sizeof(Vertex0), (void *) 0); + glDrawArrays(GL_POINTS, 0, 1); + /* destroy */ + glDeleteBuffersARB(1, &vbo); + } + glFinish(); +} + + static const GLsizei Sizes[] = { 64, 1024, @@ -164,7 +190,6 @@ PerfDraw(void) sizeof(Vertex0)); } - /* glBufferDataARB() */ for (sz = 0; Sizes[sz]; sz++) { @@ -206,5 +231,15 @@ PerfDraw(void) SubSize, VBOSize, mbPerSec); } + /* Create/Draw/Destroy + */ + for (sz = 0; Sizes[sz]; sz++) { + SubSize = VBOSize = Sizes[sz]; + rate = PerfMeasureRate(CreateDrawDestroyVBO); + mbPerSec = rate * VBOSize / (1024.0 * 1024.0); + perf_printf(" VBO Create/Draw/Destroy(size = %d): %.1f MB/sec, %.1f draws/sec\n", + VBOSize, mbPerSec, rate); + } + exit(0); } |