xuxiandi / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

eglSwapInterval(0) is not working on Windows 7 #209

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Run an application that use eglSwapBuffers(0) on Windows 7
2. Notice its syncs to a multiple of the frame rate i.e. 60, 30, 20, 15 etc Hz.

What is the expected output? What do you see instead?

The frame rate should not be synced and it should render as fast as possible. 
e.g. if it can run at 27hz it should be 27hz not 20hz.

What version of the product are you using? On what operating system?

v751 on Windows 7.

Please provide any additional information below.

Older versions (eg 609) did not have this issue. 

EGL_MIN_SWAP_INTERVAL is 0 so that appears to be correct.

It looks like this was introduced with the changes that enabled the use of 
D3DSWAPEFFECT_FLIPEX.

If you disable D3DSWAPEFFECT_FLIPEX use in Surface::resetSwapChain() it appear 
to work for < 60hz as before but is still clamped at 60hz.

Original issue reported on code.google.com by michaelb...@turbulenz.biz on 16 Sep 2011 at 2:42

GoogleCodeExporter commented 9 years ago
Did you mean eglSwapInterval(dyp, 0) instead of eglSwapBuffers?

You are correct that FLIPEX does seem to force VSYNC, which make senses since 
the whole point of it is to avoid a copy.  We should probably look into a way 
of specifically requesting it to be enabled instead of it being on all the 
time.  We've also observed that it doesn't work with 16-bit backbuffers.

However, with FLIPEX forced off, we've been able to get framerates of > 5000 
fps in a simple application.  Are you sure you don't have vsync forced on for 
d3d in the driver control panel?

Original comment by dan...@transgaming.com on 17 Sep 2011 at 12:02

GoogleCodeExporter commented 9 years ago
Yes eglSwapInterval(dyp, 0) and retesting I can get >60hz.

I thought the fix might be 

Surface::resetSwapChain
...

    bool useFlipEx = mSwapInterval && (getComparableOSVersion() >= versionWindows7) && mDisplay->isD3d9ExDevice();

but this doesn't seem to work correctly when it has to toggle between on and 
off.

Original comment by michaelb...@turbulenz.biz on 19 Sep 2011 at 2:23

GoogleCodeExporter commented 9 years ago
I tested that approach with an application that switches between swap interval 
0 and 1 every second, and it worked fine. This fix is in r764.

Please let me know if it still doesn't work for you.

Original comment by nicolas....@gmail.com on 23 Sep 2011 at 6:34

GoogleCodeExporter commented 9 years ago
claiming fixed.  please reopen if not working for you.

Original comment by dan...@transgaming.com on 23 Sep 2011 at 6:58

GoogleCodeExporter commented 9 years ago
For me this works on an Nvidia GTX460 (driver 275.65) but doesn't work on an 
AMD Radeon HD 6800 (driver 11.8) and Intel GMA4500 (driver 8.15.10.1892). AMD 
and Intel appear to freeze when going from using D3DSWAPEFFECT_FLIPEX to 
D3DSWAPEFFECT_DISCARD, it looks like the buffers are not being swapped after 
the change. It starts working again when it toggles back to using 
D3DSWAPEFFECT_FLIPEX. I can believe its a driver issue but would be interested 
to know it anyone can get it to work on an AMD or Intel graphics card.

Original comment by michaelb...@turbulenz.biz on 26 Sep 2011 at 4:03

GoogleCodeExporter commented 9 years ago
The test app I wrote was run on an Intel HD Graphics 2000, with driver version 
8.15.10.2372.

Original comment by nicolas....@gmail.com on 27 Sep 2011 at 12:39

GoogleCodeExporter commented 9 years ago
It also works for me on an ATI 5770 using the Catalyst 11.8 driver when I run 
Nicolas' test program.   Would you be able to your program which doesn't work?

Original comment by dan...@transgaming.com on 27 Sep 2011 at 1:10