mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
progs/perf: add another VBO test for Create/Draw/Destroy pattern
Report both MB/sec and draw/sec.
This commit is contained in:
parent
7e5004b298
commit
bae2d58827
1 changed files with 37 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue