glDrawElements() blocking in CPU - takes 5ms to return
I am having a strange issue where calling glDrawElements appears to be blocking; stalling the CPU for a moment while it waits for the function to return. I placed a system timer immediately before and after my call to glDrawElements and the function consistently takes betweeen 5 and 7 milliseconds to return.
First, this is very slow. I'm only rendering about 4000 vertices. Second, I thought the whole point of using VBOs was to eliminate immediate mode, so that glDrawElements would just issue commands to the GPU and the CPU can continue working while the GPU works at its own pace. This does not appear to be happening at all.
As I mentioned, my data is entirely stored in VBOs which are initialized and filled once. I am using very simple shaders. The vertex shader is handed a 20 element array of mat4's as uniforms before each render, and the pre-filled VBO's are merely activated, and vertex attribute pointers set.
The only thing I actually time is the call to glDrawElements. Which as I mentioned, takes about 5 to 7 ms.
Here are the general specs for my setup. Pretty modern. Should be fine.
Graphics card info:
Laptop: Dell XPS L511Z
i5-2410M CPU @
2.30 Ghz 2.30Ghz
Installed Memory (RAM) 6.00 GB.
System type: 64 bit operating system.
Operating system: Windows 7.
My application info:
Card type: Nvidia GeForce GT 525M
Driver Version: 285.77
DirectX support: 11
CUDA Cores: 96
Graphics clock: 600 Mhz
Processor clock:: 1200 Mhz
Memory clock: 900 Mhz (1800 Mhz data rate)
Memoryinterface: 128 bit
Total available graphics memory: 3797 MB
Dedicated video memory: 1024 MB DDR3
System video memory: 0 MB
Shared System Memory: 2773 MB
Video BIOS version: 70.08.53.00.07
Bus: PCI Express x 16 Gen 2
Win32 project written in C++ using Visual Studio 2010.