summaryrefslogtreecommitdiffstats
path: root/progs/perf/vbo.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-09-22 09:43:08 -0600
committerBrian Paul <[email protected]>2009-09-22 09:43:08 -0600
commit7e5004b298f7e6f87d659d314cac991bff7980cf (patch)
tree93e29bc4da2744d5bdc31ad33f1066a3d33b50c8 /progs/perf/vbo.c
parentaa80851e166ccee79daf6b00db70c55831bfc4b8 (diff)
progs/perf: simplify the code
Diffstat (limited to 'progs/perf/vbo.c')
-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);