Vsync doesn't seem to work...

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
Blue Shadow
Global Moderator
Global Moderator
Posts: 308
Joined: Sun Aug 29, 2010 6:09

Vsync doesn't seem to work...

Post by Blue Shadow »

For some reason, and despite having vsync set to on, my frame rate doesn't lock to my monitor's refresh rate. I'm using GZDoom r1547 (it's a little old - I know). My current screen/monitor resolution is 1152x864 (in-game resolution is 800x600), and running in windowed mode (I also tried it in fullscreen mode, but there was no difference).

With ZDoom, vsync works fine - I get a steady 70-ish fps at the start point of E1M1 of Doom, and no more. But with GZDoom, the frame rate goes beyond that, up to 130, even though I have that option set to on.

I tried vid_maxfps with setting the max to 70, however it didn't have any effect either; the frame rate is still way up. On the other hand, cl_capfps still works.
Spoiler: System specs
User avatar
Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Vsync doesn't seem to work...

Post by Gez »

vid_maxfps isn't implemented in the OpenGL renderer.

In OpenGL, vsync is handled... by OpenGL. Look at the last line here:

Code: Select all

OpenGLFrameBuffer::OpenGLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen) : 
	Super(hMonitor, width, height, bits, refreshHz, fullscreen) 
{
	GLRenderer = new FGLRenderer(this);
	memcpy (SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256);
	UpdatePalette ();
	ScreenshotBuffer = NULL;
	LastCamera = NULL;

	InitializeState();
	gl_SetupMenu();
	gl_GenerateGlobalBrightmapFromColormap();
	DoSetGamma();
	needsetgamma = true;
	swapped = false;
	Accel2D = true;
	if (gl.SetVSync!=NULL) gl.SetVSync(vid_vsync);
}
This is the only place in the GL code where vid_vsync is referenced. To me, it means that your OpenGL drivers either do not support SetVSync at all (function not present) or they do but it doesn't work.

Anyways, works for me.
Blue Shadow
Global Moderator
Global Moderator
Posts: 308
Joined: Sun Aug 29, 2010 6:09

Re: Vsync doesn't seem to work...

Post by Blue Shadow »

Gez wrote:vid_maxfps isn't implemented in the OpenGL renderer.
Oh! I wasn't aware of that. Why is it not, I wonder? Any specific reason(s)?
To me, it means that your OpenGL drivers either do not support SetVSync at all (function not present) or they do but it doesn't work.
Not that it matters, now, but is there a way for me to find out if it's supported or not?
User avatar
Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: Vsync doesn't seem to work...

Post by Gez »

Blue Shadow wrote:
Gez wrote:vid_maxfps isn't implemented in the OpenGL renderer.
Oh! I wasn't aware of that. Why is it not, I wonder? Any specific reason(s)?
I have no idea how to do that, I have not much motivation to look into it, and if you go back to the original feature request thread, Graf was hostile to the idea.
Blue Shadow wrote:
To me, it means that your OpenGL drivers either do not support SetVSync at all (function not present) or they do but it doesn't work.
Not that it matters, now, but is there a way for me to find out if it's supported or not?
Well. If you can compile a custom build, you could look for this code in src/gl/system/gl_interface.cpp:

Code: Select all

#if !defined (unix) && !defined (__APPLE__)
	PFNWGLSWAPINTERVALEXTPROC vs = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
	if (vs) gl->SetVSync = vs;
#endif
Add a line like this after the call to wglGetProcAddress, but before the #endif:

Code: Select all

	Printf("GL proc address for vsync: %x\n", vs");
Then compile, run GZDoom, and look in your console log if the given address is 0 or some non-null hex value.

It might also be indicated somewhere in this utility's various reports, I'm not sure.
User avatar
NeuralStunner
Posts: 253
Joined: Tue Dec 29, 2009 3:46
Location: IN SPACE
Contact:

Re: Vsync doesn't seem to work...

Post by NeuralStunner »

I thought windowed mode implied vsync. (In the sense that your desktop runs at target framerate.)
Dean Koontz wrote:Human beings can always be relied upon to exert, with vigor, their God-given right to be stupid.
Spoiler: System Specs
Blue Shadow
Global Moderator
Global Moderator
Posts: 308
Joined: Sun Aug 29, 2010 6:09

Re: Vsync doesn't seem to work...

Post by Blue Shadow »

Okay, I've managed to compile a custom GZDoom build with the modification you suggested, Gez - Here is what the console printed:

Code: Select all

GL proc address for vsync: afb23d0
What does that mean?
Locked

Return to “GZDoom”