summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--progs/perf/vbo.c83
1 files changed, 39 insertions, 44 deletions
diff --git a/progs/perf/vbo.c b/progs/perf/vbo.c
index 12ad789aa03..ab893315e7f 100644
--- a/progs/perf/vbo.c
+++ b/progs/perf/vbo.c
@@ -152,9 +152,10 @@ void
PerfDraw(void)
{
double rate, mbPerSec;
- int sub, sz;
- int i;
+ int i, sz;
+ /* Load VBOData buffer with duplicated Vertex0.
+ */
VBOData = calloc(DATA_SIZE, 1);
for (i = 0; i < DATA_SIZE / sizeof(Vertex0); i++) {
@@ -164,51 +165,45 @@ PerfDraw(void)
}
- /* loop over whole/sub buffer upload */
- for (sub = 0; sub < 3; sub++) {
-
- if (sub == 2) {
- VBOSize = 1024 * 1024;
-
- glBufferDataARB(GL_ARRAY_BUFFER, VBOSize, VBOData, GL_STREAM_DRAW_ARB);
-
- for (sz = 0; Sizes[sz] < VBOSize; sz++) {
- SubSize = Sizes[sz];
- rate = PerfMeasureRate(UploadSubVBO);
-
- mbPerSec = rate * SubSize / (1024.0 * 1024.0);
-
- perf_printf(" glBufferSubDataARB(size = %d, VBOSize = %d): %.1f MB/sec\n",
- SubSize, VBOSize, mbPerSec);
- }
-
- for (sz = 0; Sizes[sz] < VBOSize; sz++) {
- SubSize = Sizes[sz];
- rate = PerfMeasureRate(BatchUploadSubVBO);
-
- mbPerSec = rate * SubSize / (1024.0 * 1024.0);
-
- perf_printf(" glBufferSubDataARB(size = %d, VBOSize = %d), batched: %.1f MB/sec\n",
- SubSize, VBOSize, mbPerSec);
- }
- }
- else {
-
- /* loop over VBO sizes */
- for (sz = 0; Sizes[sz]; sz++) {
- SubSize = VBOSize = Sizes[sz];
+ /* glBufferDataARB()
+ */
+ for (sz = 0; Sizes[sz]; sz++) {
+ SubSize = VBOSize = Sizes[sz];
+ rate = PerfMeasureRate(UploadVBO);
+ mbPerSec = rate * VBOSize / (1024.0 * 1024.0);
+ perf_printf(" glBufferDataARB(size = %d): %.1f MB/sec\n",
+ VBOSize, mbPerSec);
+ }
- if (sub == 1)
- rate = PerfMeasureRate(UploadSubVBO);
- else
- rate = PerfMeasureRate(UploadVBO);
+ /* glBufferSubDataARB()
+ */
+ for (sz = 0; Sizes[sz]; sz++) {
+ SubSize = VBOSize = Sizes[sz];
+ rate = PerfMeasureRate(UploadSubVBO);
+ mbPerSec = rate * VBOSize / (1024.0 * 1024.0);
+ perf_printf(" glBufferSubDataARB(size = %d): %.1f MB/sec\n",
+ VBOSize, mbPerSec);
+ }
- mbPerSec = rate * VBOSize / (1024.0 * 1024.0);
+ /* Batch upload
+ */
+ VBOSize = 1024 * 1024;
+ glBufferDataARB(GL_ARRAY_BUFFER, VBOSize, VBOData, GL_STREAM_DRAW_ARB);
+
+ for (sz = 0; Sizes[sz] < VBOSize; sz++) {
+ SubSize = Sizes[sz];
+ rate = PerfMeasureRate(UploadSubVBO);
+ mbPerSec = rate * SubSize / (1024.0 * 1024.0);
+ perf_printf(" glBufferSubDataARB(size = %d, VBOSize = %d): %.1f MB/sec\n",
+ SubSize, VBOSize, mbPerSec);
+ }
- perf_printf(" glBuffer%sDataARB(size = %d): %.1f MB/sec\n",
- (sub ? "Sub" : ""), VBOSize, mbPerSec);
- }
- }
+ for (sz = 0; Sizes[sz] < VBOSize; sz++) {
+ SubSize = Sizes[sz];
+ rate = PerfMeasureRate(BatchUploadSubVBO);
+ mbPerSec = rate * SubSize / (1024.0 * 1024.0);
+ perf_printf(" glBufferSubDataARB(size = %d, VBOSize = %d), batched: %.1f MB/sec\n",
+ SubSize, VBOSize, mbPerSec);
}
exit(0);