Source/Fusion/Windows/VerticalSynchronization.cs
/// <summary>
/// Make sure to call this after a Window context is made!
/// </summary>
/// <returns></returns>
Make sure to call this after a Window context is made!
Make sure to call this after a Window context is made!
public static IVSyncContext CreateContext()
		{
			try
			{
				var openAdapter = new D3DKMT_OPENADAPTERFROMHDC();
				var waitForVblankEvent = new D3DKMT_WAITFORVERTICALBLANKEVENT();
				var hdc = CreateDC(Screen.PrimaryScreen.DeviceName, null, null, IntPtr.Zero);
				openAdapter.hDc = hdc;
				var result = D3DKMTOpenAdapterFromHdc(ref openAdapter);
				if (result != 0)
					throw new Exception("D3DKMTOpenAdapterFromHdc failed");
				waitForVblankEvent.hAdapter = openAdapter.hAdapter;
				waitForVblankEvent.hDevice = 0;
				waitForVblankEvent.VidPnSourceId = openAdapter.VidPnSourceId;
				return new VsyncContext(waitForVblankEvent);
			}
			catch (Exception e)
			{
				ReportFactory.FallbackReport.Error(e);
			}
			return new SimulatedVSync();
		}
public static IVSyncContext CreateContext ( ) { try { var openAdapter = new D3DKMT_OPENADAPTERFROMHDC ( ) ; var waitForVblankEvent = new D3DKMT_WAITFORVERTICALBLANKEVENT ( ) ; var hdc = CreateDC ( Screen . PrimaryScreen . DeviceName , null , null , IntPtr . Zero ) ; openAdapter . hDc = hdc ; var result = D3DKMTOpenAdapterFromHdc ( ref openAdapter ) ; if ( result != 0 ) throw new Exception ( " " ) ; waitForVblankEvent . hAdapter = openAdapter . hAdapter ; waitForVblankEvent . hDevice = 0 ; waitForVblankEvent . VidPnSourceId = openAdapter . VidPnSourceId ; return new VsyncContext ( waitForVblankEvent ) ; } catch ( Exception e ) { ReportFactory . FallbackReport . Error ( e ) ; } return new SimulatedVSync ( ) ; }
Make sure to call this after a Window context is made!
Make sure to call this after a Window context is made!
None