I've narrowed down the problem to glDrawElementsInstanced() specifically. glDrawArraysInstanced() does not suffer from the insane CPU usage.
I've made a small program that renders 524 288 small 1-pixel quads over a window.
- My pseudo-instancing method manages 93 FPS (uses glDrawElements() and draws 512 instances per batch).
- Rendering 512 instances per batch using glDrawArraysInstanced() gives me 43 FPS, which is decent.
- Rendering 512 instances per batch using glDrawElementsInstanced() gives me an abysmal 10 FPS.
- Rendering all instances using a single call to glDrawArraysInstanced() gives me 104 FPS as expected!
- Rendering all instances using a single call to glDrawElementsInstanced() gives me 11 FPS.
The test can be found here: http://www.mediafire.com/?2i0vd909uw3salk
- Run by starting run.bat. You need to have Java installed. If it can't find Java, try to hardcode the path to java.exe in the bat-file.
- The program pops up an option box where you can choose one of the 5 modes above. The peudo-instancing mode and the pure instancing modes are the interesting ones.
- FPS is printed to the console every second.
The source can be found here: http://pastie.org/8069712 and requires LWJGL for OpenGL access. Shader source can be found in the shaders/ directory that comes with the test program.
So... How do I report this so Nvidia actually listens? Isn't this a pretty serious bug?