🔒 Locked
tearing
Advertisement
Original Post
I have a Direct3D9 device created with: D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Behavior flags - D3DCREATE_MULTITHREADED - D3DCREATE_HARDWARE_VERTEXPROCESSING D3DPRESENT_PARAMETERS - BackBufferWidth 1676 - BackBufferHeight 818 - BackBufferFormat D3DFMT_X8R8G8B8 - BackBufferCount 1 - MultiSampleType D3DMULTISAMPLE_2_SAMPLES - MultiSampleQuality 0 - Swapeffect D3DSWAPEFFECT_DISCARD - Windowed 1 - EnableAutoDepthStencil 1 - AutoDepthStencilFormat D3DFMT_D24S8 - Flags 0 - FullScreen_RefreshRateInHz 0 - PresentationInterval D3DPRESENT_INTERVAL_DEFAULT These are the values after CreateDevice returns successful. I'm seeing signicant tearing despite the use of a back buffer. Any ideas how I can eliminate the tearing? The D3D_SDK_VERSION is 31, and the card I'm running on is a NVIDIA GeForce Go 7400. I'm calling IDirect3DDevice9::Present( NULL, NULL, NULL, NULL ) at the end of my render loop. Thanks, Jason
i thought immediate presentation interval enables vsync too, but in torque game engine advanced after line where specifying immediate mode is a comment telling something like "this does not wait for vsync". so what is correct? try default presentation interval to see if that helps
As you can see from my first post, I did try the default presentation interval.
In fact, I've tried each of the following presentation intervals which the Caps Viewer reports are supported by my NVIDIA GeForce Go 7400 card:
D3DPRESENT_INTERVAL_DEFAULT // significant tearing, 15 FPS
D3DPRESENT_INTERVAL_ONE // significant tearing, 15 FPS
D3DPRESENT_INTERVAL_TWO // Direct3D9: (ERROR) :Invalid value for PresentationInterval. ValidatePresentParameters fails.
D3DPRESENT_INTERVAL_THREE // Direct3D9: (ERROR) :Invalid value for PresentationInterval. ValidatePresentParameters fails.
D3DPRESENT_INTERVAL_FOUR // Direct3D9: (ERROR) :Invalid value for PresentationInterval. ValidatePresentParameters fails.
D3DPRESENT_INTERVAL_IMMEDIATE // significant tearing, 28 FPS
All the other D3DPRESENT_PARAMETERS are identical to the original case.
The fact that my frame rate drops drastically for the DEFAULT and ONE intervals makes me believe a timed swap is indeed happening, but the tearing with these intervals is almost as bad as the IMMEDIATE interval, if not as bad.
I'm concerned that the higher-order presentation intervals fail, despite their support in the HAL CAPS. Of course, I'm using the Caps Viewer from the November '07 SDK, which is not actually the DX9 SDK I'm linking to (see version above).
Also, this is a multi-threaded app, so perhaps there's some weirdness with mutual exclusion and the buffers?
In fact, I've tried each of the following presentation intervals which the Caps Viewer reports are supported by my NVIDIA GeForce Go 7400 card:
D3DPRESENT_INTERVAL_DEFAULT // significant tearing, 15 FPS
D3DPRESENT_INTERVAL_ONE // significant tearing, 15 FPS
D3DPRESENT_INTERVAL_TWO // Direct3D9: (ERROR) :Invalid value for PresentationInterval. ValidatePresentParameters fails.
D3DPRESENT_INTERVAL_THREE // Direct3D9: (ERROR) :Invalid value for PresentationInterval. ValidatePresentParameters fails.
D3DPRESENT_INTERVAL_FOUR // Direct3D9: (ERROR) :Invalid value for PresentationInterval. ValidatePresentParameters fails.
D3DPRESENT_INTERVAL_IMMEDIATE // significant tearing, 28 FPS
All the other D3DPRESENT_PARAMETERS are identical to the original case.
The fact that my frame rate drops drastically for the DEFAULT and ONE intervals makes me believe a timed swap is indeed happening, but the tearing with these intervals is almost as bad as the IMMEDIATE interval, if not as bad.
I'm concerned that the higher-order presentation intervals fail, despite their support in the HAL CAPS. Of course, I'm using the Caps Viewer from the November '07 SDK, which is not actually the DX9 SDK I'm linking to (see version above).
Also, this is a multi-threaded app, so perhaps there's some weirdness with mutual exclusion and the buffers?
Ahh, I was going to ask you to verify the framerate but you posted it anyway. Refresh rates for monitors are typically in 60-75Hz range. D3DPRESENT_INTERVAL_IMMEDIATE specifies that your app should render as quickly as it can without waiting to sync with the monitor's refresh. This means IDirec3DDevice9::Present() returns immediately, and doesn't block your app. When you have this set, you're only getting 28 FPS. Then when you enable VSYNC a la D3DPRESENT_INTERVAL_ONE, Present blocks your app until it can sync with the monitor's refresh. Assuming your refresh is 60 it won't be able to sync on every frame (since your app is rendering too slowly), and it also won't be able to sync every other frame because it's rendering slower than 30 fps. Instead it seems to be syncing with every 4th refresh, hence the 15 FPS.
Of course, you still shouldn't be getting tearing...although I'll admit I'm unsure of the how VSYNC functions when in windowed mode under XP. You are running in windowed mode, right?
Of course, you still shouldn't be getting tearing...although I'll admit I'm unsure of the how VSYNC functions when in windowed mode under XP. You are running in windowed mode, right?
Presentation intervals parameters are generally regarded as hints by most drivers, not requirements. Check your GPU's control panel - it'll probably have an "always off" / "application setting" / "always on" setting for VSYNC.
Depending on the setting for that option it might well impact what you can/can't do within your own code.
hth
Jack
Depending on the setting for that option it might well impact what you can/can't do within your own code.
hth
Jack
More information:
In this old DX9 SDK, the tearing is eliminated with a call to ID3DXFont::DrawText, while the frame rate remains at about 15.
However, using the November '07 SDK, the tearing is back. The number of parameters to ID3DXFont::DrawText has changed in these versions. Any idea what the functional difference is?
I'm passing in NULL for the new parameter, a LPD3DXSPRITE pSprite.
I am running DirectX inside an ActiveX Control, if that means anything.
[Edited by - jmallios on January 17, 2008 6:26:32 PM]
In this old DX9 SDK, the tearing is eliminated with a call to ID3DXFont::DrawText, while the frame rate remains at about 15.
However, using the November '07 SDK, the tearing is back. The number of parameters to ID3DXFont::DrawText has changed in these versions. Any idea what the functional difference is?
I'm passing in NULL for the new parameter, a LPD3DXSPRITE pSprite.
I am running DirectX inside an ActiveX Control, if that means anything.
[Edited by - jmallios on January 17, 2008 6:26:32 PM]
We've tried multiple computers and cards. The tearing occurs on an Intel 945 Mobile Express, an Intel 965 Mobile Express, and the NVIDIA 7400 Go. It does not occur on an NVIDIA 8600 GT. The Intel control panels only have OpenGL options, and the NVIDIA 7400 Go has no software available on either NVIDIA's or Sony's site other than the original driver.
[Edited by - jmallios on January 22, 2008 2:11:44 PM]
[Edited by - jmallios on January 22, 2008 2:11:44 PM]
Quote:They don't make any difference. I bet all that's happening is that rendering is taking ever so slightly longer, which eliminates tearing.
Original post by jmallios
More information:
In this old DX9 SDK, the tearing is eliminated with a call to ID3DXFont::DrawText, while the frame rate remains at about 15.
However, using the November '07 SDK, the tearing is back. The number of parameters to ID3DXFont::DrawText has changed in these versions. Any idea what the functional difference is?
I'm passing in NULL for the new parameter, a LPD3DXSPRITE pSprite.
I am running DirectX inside an ActiveX Control, if that means anything.
If you're rendering in an ActiveX control, maybe it does some sort of buffering which is causing this? If you're rendering windowed, then D3D will internally be using BitBlt() to blit to the window, so it shouldn't tear anyway.
You could try using D3DSWAPEFFECT_COPY instead of D3DSWAPEFFECT_DISCARD and see if that makes any difference. You could also try rendering to a normal window instead of an ActiveX control (Although that might take a significant amount of code).
Did you check your driver settings as Jack suggested? The driver is free to completely ignore the presentation interval setting if it feels like it. And have you tried on other PCs?
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement