Vsync Is Absent in 2.3.2

Something not working in GZDoom that's not a bug? Is the display a bit quirky and unexpected? Post here.

Moderator: Graf Zahl

Locked
blueinferno776
Corrupt Bootloader
Posts: 26
Joined: Sat Aug 31, 2013 9:16

Vsync Is Absent in 2.3.2

Post by blueinferno776 » Sun Feb 26, 2017 1:47

Vsync does not work with the current release or any of the unofficial builds when turned on. I can only get it to work when I force it on in radeon settings but it seems to slow gzdoom down by a lot.

This really is persisting through every 2.4.0 git build too. I waited to see if someone else has had this problem but now it clear that I needed to say something about it now.

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Vsync Is Absent in 2.3.2

Post by dpJudas » Sun Feb 26, 2017 5:59

Mind try downloading a nightly build of QZDoom? Boot it in software mode, go to "Options->Change Rendering Output" and switch "Software Canvas" to OpenGL, and then restart QZDoom once again. Then check if vsync is working there.

It will be useful for me to know if that is the case or not. If it works in QZDoom's OpenGL software canvas, then I have a good theory on what might be broken in GZDoom.

@Graf: The OpenGLFrameBuffer class in GZDoom might need the following code from OpenGLSWFrameBuffer::SetVSync:

Code: Select all

void OpenGLSWFrameBuffer::SetVSync(bool vsync)
{
	// Switch to the default frame buffer because Nvidia's driver associates the vsync state with the bound FB object.
	GLint oldDrawFramebufferBinding = 0, oldReadFramebufferBinding = 0;
	glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldDrawFramebufferBinding);
	glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &oldReadFramebufferBinding);
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
	glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);

	Super::SetVSync(vsync);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, oldDrawFramebufferBinding);
	glBindFramebuffer(GL_READ_FRAMEBUFFER, oldReadFramebufferBinding);
}
I'm not 100% sure if the default FB is bound in GZDoom when vid_vsync is changed. If it isn't, bad things might happen.

blueinferno776
Corrupt Bootloader
Posts: 26
Joined: Sat Aug 31, 2013 9:16

Re: Vsync Is Absent in 2.3.2

Post by blueinferno776 » Sun Feb 26, 2017 6:34

Vsync works perfect with QZdooms opengl render canvas. GZdoom just outright ignores the vsync option.

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Vsync Is Absent in 2.3.2

Post by dpJudas » Sun Feb 26, 2017 7:44

Thanks for testing. Adding the code from my previous post to GZDoom will probably fix it then.

User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: Vsync Is Absent in 2.3.2

Post by Graf Zahl » Sun Feb 26, 2017 13:49

Can you make a pull request?

Also, what hardware was this problem on? It works fine for me on a Geforce 550ti.

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Vsync Is Absent in 2.3.2

Post by dpJudas » Sun Feb 26, 2017 14:22

Okay, I'll create a pull request with it a little later today.

Originally I experienced a vsync problem on some Nvidia cards when I added the render buffer stuff. Back then, I managed to make it stop by firing off a vsync (wglSetInterval or whatever its called) call before creating any frame buffer objects. When I then much later ported Randi's D3D9 FB to OpenGL the problem resurfaced for me. This time because the code there has the frame buffer object bound when the vid_vsync custom CVAR fires.

While all that was for Nvidia here we have an AMD card showing similar kind of behavior. So my guess is that it is very important to make sure wglSetInterval and wglSwapBuffers calls are only executed when the default frame buffer object is bound. Since blueinferno776 is not seeing the problem with OpenGLSWFrameBuffer I think there is a fair chance this will fix his vsync issue.

Locked

Return to “Technical Support”