Had this error for a long time (at least with NVidia cards, somehow the ATI I had before wasn't showing up that bug).
I checked the source. In d3dapp.cs, BuildPresentParamsFromSettings function:
even though I'm starting MP fullscreen, windowed is true. Therefore, the presentation used is PresentInterval.Immediate, which causes tearing as it's not waiting the vsync to present the backbuffers.
PresentInterval.Default should be used instead, to preserve vsync at all time.
Should be this way instead (and I tested it, it works fine):
Please put that fix in, it's going to make a lot of people happy.
I checked the source. In d3dapp.cs, BuildPresentParamsFromSettings function:
Code:
if (windowed)
{
presentParams.MultiSample = graphicsSettings.WindowedMultisampleType;
presentParams.MultiSampleQuality = graphicsSettings.WindowedMultisampleQuality;
presentParams.AutoDepthStencilFormat = graphicsSettings.WindowedDepthStencilBufferFormat;
presentParams.BackBufferWidth = ourRenderTarget.ClientRectangle.Right - ourRenderTarget.ClientRectangle.Left;
presentParams.BackBufferHeight = ourRenderTarget.ClientRectangle.Bottom - ourRenderTarget.ClientRectangle.Top;
presentParams.BackBufferFormat = graphicsSettings.BackBufferFormat;
presentParams.PresentationInterval = PresentInterval.Immediate;
presentParams.FullScreenRefreshRateInHz = 0;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.PresentFlag = PresentFlag.Video; //PresentFlag.LockableBackBuffer;
presentParams.DeviceWindow = ourRenderTarget;
presentParams.Windowed = true;
//presentParams.PresentationInterval = PresentInterval.Immediate;
}
else
{
presentParams.MultiSample = graphicsSettings.FullscreenMultisampleType;
presentParams.MultiSampleQuality = graphicsSettings.FullscreenMultisampleQuality;
presentParams.AutoDepthStencilFormat = graphicsSettings.FullscreenDepthStencilBufferFormat;
presentParams.BackBufferWidth = graphicsSettings.DisplayMode.Width;
presentParams.BackBufferHeight = graphicsSettings.DisplayMode.Height;
presentParams.BackBufferFormat = graphicsSettings.DeviceCombo.BackBufferFormat;
presentParams.PresentationInterval = PresentInterval.Default;
presentParams.FullScreenRefreshRateInHz = graphicsSettings.DisplayMode.RefreshRate;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.PresentFlag = PresentFlag.Video; //|PresentFlag.LockableBackBuffer;
presentParams.DeviceWindow = this;
presentParams.Windowed = false;
}
even though I'm starting MP fullscreen, windowed is true. Therefore, the presentation used is PresentInterval.Immediate, which causes tearing as it's not waiting the vsync to present the backbuffers.
PresentInterval.Default should be used instead, to preserve vsync at all time.
Should be this way instead (and I tested it, it works fine):
Code:
if (windowed)
{
presentParams.MultiSample = graphicsSettings.WindowedMultisampleType;
presentParams.MultiSampleQuality = graphicsSettings.WindowedMultisampleQuality;
presentParams.AutoDepthStencilFormat = graphicsSettings.WindowedDepthStencilBufferFormat;
presentParams.BackBufferWidth = ourRenderTarget.ClientRectangle.Right - ourRenderTarget.ClientRectangle.Left;
presentParams.BackBufferHeight = ourRenderTarget.ClientRectangle.Bottom - ourRenderTarget.ClientRectangle.Top;
presentParams.BackBufferFormat = graphicsSettings.BackBufferFormat;
presentParams.PresentationInterval = PresentInterval.Default;
presentParams.FullScreenRefreshRateInHz = 0;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.PresentFlag = PresentFlag.Video; //PresentFlag.LockableBackBuffer;
presentParams.DeviceWindow = ourRenderTarget;
presentParams.Windowed = true;
//presentParams.PresentationInterval = PresentInterval.Immediate;
}
else
{
presentParams.MultiSample = graphicsSettings.FullscreenMultisampleType;
presentParams.MultiSampleQuality = graphicsSettings.FullscreenMultisampleQuality;
presentParams.AutoDepthStencilFormat = graphicsSettings.FullscreenDepthStencilBufferFormat;
presentParams.BackBufferWidth = graphicsSettings.DisplayMode.Width;
presentParams.BackBufferHeight = graphicsSettings.DisplayMode.Height;
presentParams.BackBufferFormat = graphicsSettings.DeviceCombo.BackBufferFormat;
presentParams.PresentationInterval = PresentInterval.Default;
presentParams.FullScreenRefreshRateInHz = graphicsSettings.DisplayMode.RefreshRate;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.PresentFlag = PresentFlag.Video; //|PresentFlag.LockableBackBuffer;
presentParams.DeviceWindow = this;
presentParams.Windowed = false;
}
Please put that fix in, it's going to make a lot of people happy.