Are the times in the graph milliseconds (ms)? If so, wow --that’s some spike!
Yes, milliseconds.
If not, it could be excess time consumption in your process, or it could be a background process kicking you off a CPU core for a while. Run a process monitor which sorts processes by CPU utilization and updates 10X a second. You can watch it to verify that your process is never preempted and if it is, by what (you may need to disable Sync-to-VBlank here to ensure your process has consistently high CPU utilization). If something else kicks you off, resolve that problem and retest.
Thanks for the suggestions. I ran the application alongside process explorer and had the latter update as fast as it could. I’ve been unable to uncover any background process preempting the application, although it doesn’t rule out this possibility. But since the spikes happen on discrete frames and the behavior is deterministic (always the same frames) and found exclusively on Nvidia Geforce cards (and not ATI), I suspect the slowdowns occur within Nvidia driver. I generated a timeline using the Nsight performance analyzer and it seems the spikes happen in the middle of wglSwapBuffers calls, further reinforcing the suspicion about the driver performing some weird stuff behind the curtain. I already made use of performance counters to obtain precise frame timings.
Just to clarify - the frames here are all the very same? In other words, with the exception of the spike, there is no other difference between the frame on which the spike occurs and all of the other frames between program startup and the spike, and the very same scene is drawn in all of them?
Yes, it’s always the exact same scene and no GL resource allocation (or any other kind of allocation for that matter) is taking place after the first frame is rendered. A call is made to glGenerateMipmaps on every frame, which should theoretically not need to allocate anything beyond the first call, but even after commenting it out, I still have the spikes.
Here’s the GLIntercept trace you’ve asked for:
glBindFramebuffer(GL_DRAW_FRAMEBUFFER,1)
glClearColor(0.400000,0.400000,0.800000,1.000000)
glDrawBuffers(1,0042F954)
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
glViewport(0,0,2048,2048)
glUseProgram(4)
glBindBuffer(GL_UNIFORM_BUFFER,1)
glBufferSubData(GL_UNIFORM_BUFFER,176,48,005CDF04)
glBindBuffer(GL_UNIFORM_BUFFER,0)
glBindBuffer(GL_UNIFORM_BUFFER,1)
glBufferSubData(GL_UNIFORM_BUFFER,128,48,005CE300)
glBindBuffer(GL_UNIFORM_BUFFER,0)
glBindBuffer(GL_UNIFORM_BUFFER,1)
glBufferSubData(GL_UNIFORM_BUFFER,64,64,005CE084)
glBindBuffer(GL_UNIFORM_BUFFER,0)
glBindBuffer(GL_UNIFORM_BUFFER,1)
glBufferSubData(GL_UNIFORM_BUFFER,0,64,005CE0C4)
glBindBuffer(GL_UNIFORM_BUFFER,0)
glBindBuffer(GL_UNIFORM_BUFFER,2)
glBufferSubData(GL_UNIFORM_BUFFER,0,80,005CE4A0)
glBindBuffer(GL_UNIFORM_BUFFER,0)
glBindVertexArray(2)
glDrawElements(GL_TRIANGLES,17412,GL_UNSIGNED_INT,00000000)
glBindVertexArray(0)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER,0)
glBindTexture(GL_TEXTURE_2D,1)
glGenerateMipmap(GL_TEXTURE_2D)
glFinish()
glGetTexImage(GL_TEXTURE_2D,2,GL_RGBA,GL_UNSIGNED_BYTE,05D60020)
glFlush()
wglSwapBuffers(4C0117AD)=true
Your help is truly appreciated, thanks!
PM