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;
glFinish();
}
+
/* Do multiple small SubData uploads, then call DrawArrays. This may be a
* fairer comparison to back-to-back BufferData calls:
*/
}
+/**
+ * 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,
sizeof(Vertex0));
}
-
/* glBufferDataARB()
*/
for (sz = 0; Sizes[sz]; sz++) {
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);
}