Basic frame timing and measurement

Started by
0 comments, last by Hodgman 7 years ago

Hi! I am making an extremely simple (two mesh) visualization on Windows and I was wondering if I could just call wglSwapInterval(1) and run everything as fast as possible. As long as I hit the 16ms budget, I am guaranteed not to drop any frames, right?

Related, I would like to measure my times like in X-Plane -- they have a statistic for CPU and GPU that gives millisecond counts. Is that as simple as timing my main game loop? Would my timer include the call to wglSwapInterval? That would include the blocking wait, right? Also, I don't really even know where to begin with measuring my GPU milliseconds. Is there a function for that in OpenGL or is it all driver-specific?

Thanks,

Nick

Advertisement

Is that as simple as timing my main game loop? Would my timer include the call to wglSwapInterval? That would include the blocking wait, right?

Yes and yes. The swap function only blocks if necessary. It does not wait for the GPU to complete the current commands -- it only blocks if the CPU is getting to far ahead, and more than a few frames worth of commands are starting to pile up in a big queue into the GPU.

Also, I don't really even know where to begin with measuring my GPU milliseconds. Is there a function for that in OpenGL or is it all driver-specific?

https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_timer_query.txt

This topic is closed to new replies.

Advertisement