Sudden performance drop while rendering

Today I tried some benchmarking with my animation algo and came about something very weird.

I first render 1 character, then increase the amount to about 700 characters and go back to 1 character. But see whats happening; suddenly the performance goes down from 110MVerts/sec to about half, 65MVerts/s. I didnt change anything in my program at this time…

I found its glFinish() where all the time is consumed, and its caused by the asynchronous glReadPixels() to copy FBO->PBO.

Does anybody experienced something similar ?
Is it a well known and already fixed driverbug ?

I found it only happens if a large amount of triangles is pushed
( like a scene with more than 3M vertices )

Here in detail:
Fps:35, 28.361 ms 0.28 MTps 0.83 MVps Scene:0.02 MVerts 1 Characters
Fps:33, 30.294 ms 0.26 MTps 0.78 MVps Scene:0.02 MVerts 1 Characters
Fps:34, 28.886 ms 0.28 MTps 0.83 MVps Scene:0.05 MVerts 2 Characters
Fps:27, 38.143 ms 3.42 MTps 10.26 MVps Scene:0.69 MVerts 29 Characters
Fps:20, 48.095 ms 6.09 MTps 18.27 MVps Scene:1.02 MVerts 43 Characters
Fps:23, 41.792 ms 7.83 MTps 23.50 MVps Scene:1.02 MVerts 43 Characters
Fps:20, 48.143 ms 6.81 MTps 20.43 MVps Scene:1.02 MVerts 43 Characters
Fps:27, 35.893 ms 9.20 MTps 27.59 MVps Scene:1.02 MVerts 43 Characters
Fps:14, 72.067 ms 27.24 MTps 81.73 MVps Scene:12.26 MVerts 516 Characters
Fps:7, 128.500 ms 36.10 MTps 108.30 MVps Scene:16.35 MVerts 688 Characters
Fps:7, 133.000 ms 38.14 MTps 114.43 MVps Scene:16.35 MVerts 688 Characters
Fps:7, 135.625 ms 38.14 MTps 114.43 MVps Scene:16.35 MVerts 688 Characters
Fps:5, 185.333 ms 27.24 MTps 81.73 MVps Scene:16.35 MVerts 688 Characters << why :confused:
Fps:4, 239.400 ms 21.80 MTps 65.39 MVps Scene:16.35 MVerts 688 Characters << !!!
Fps:4, 239.600 ms 21.80 MTps 65.39 MVps Scene:16.35 MVerts 688 Characters
Fps:4, 237.400 ms 21.80 MTps 65.39 MVps Scene:16.35 MVerts 688 Characters
Fps:4, 243.000 ms 21.80 MTps 65.39 MVps Scene:16.35 MVerts 688 Characters
Fps:4, 239.000 ms 19.10 MTps 57.31 MVps Scene:12.36 MVerts 520 Characters
Fps:4, 210.000 ms 12.51 MTps 37.54 MVps Scene:7.70 MVerts 324 Characters
Fps:5, 199.667 ms 7.92 MTps 23.76 MVps Scene:2.95 MVerts 124 Characters
Fps:5, 171.167 ms 1.81 MTps 5.44 MVps Scene:0.62 MVerts 26 Characters
Fps:5, 186.000 ms 0.91 MTps 2.73 MVps Scene:0.50 MVerts 21 Characters
Fps:4, 208.000 ms 0.59 MTps 1.76 MVps Scene:0.40 MVerts 17 Characters
Fps:5, 168.333 ms 0.55 MTps 1.66 MVps Scene:0.29 MVerts 12 Characters
Fps:5, 210.833 ms 0.36 MTps 1.07 MVps Scene:0.17 MVerts 7 Characters
Fps:4, 211.200 ms 0.14 MTps 0.43 MVps Scene:0.07 MVerts 3 Characters
Fps:4, 207.400 ms 0.04 MTps 0.12 MVps Scene:0.02 MVerts 1 Characters
Fps:4, 204.000 ms 0.03 MTps 0.10 MVps Scene:0.02 MVerts 1 Characters
-> and the worst, the framerate does not recover !!

The animation is done via PBO (render FBO, copy to VBO),
Hardware: NVidia6600GT, WinXP, 81.98 drivers.
On the newest drivers, I cant get glReadPixels doing
its job in general, so I cannot say whether its fixed there.

>> I found it only happens if a large amount of >> triangles is pushed ( like a scene with more >> than 3M vertices )

That may explain why, do you really need to push them on the stack? Maybe you need to divide your task in two or three pieces to improve the performance.

Actually that with 3M vertices just has been a test; its not required for my project. But still was surprised how this could happen - I thought a glFinish is waiting until every background-task is finished, isn’t ?
The triangles are not pushed at once. There are 43 different vertex buffers (43 chars) which are repeatedly rendered to reach 688 characters. The glReadPixels is called once for each character.

A unconventional solution could be to buy a NV8800. Then I can switch to texture_buffer_objects and don’t need the readpixels anymore :slight_smile: