示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="waitForVSync"></param>
 public override void SwapBuffers(bool waitForVSync)
 {
     D3D.Device device = driver.Device;
     if (device != null)
     {
         int status;
         // tests coop level to make sure we are ok to render
         device.CheckCooperativeLevel(out status);
         if (status == (int)Microsoft.DirectX.Direct3D.ResultCode.Success)
         {
             // swap back buffer to the front
             if (isSwapChain)
             {
                 swapChain.Present();
             }
             else
             {
                 device.Present();
             }
         }
         else if (status == (int)Microsoft.DirectX.Direct3D.ResultCode.DeviceLost)
         {
             // Device is lost, and is not available for reset now
             log.Warn("Device State: DeviceLost");
             D3D9RenderSystem renderSystem = (D3D9RenderSystem)Root.Instance.RenderSystem;
             renderSystem.NotifyDeviceLost();
         }
         else if (status == (int)Microsoft.DirectX.Direct3D.ResultCode.DeviceNotReset)
         {
             // The device needs to be reset, and has not yet been reset.
             log.Warn("Device State: DeviceNotReset");
             device.Reset(device.PresentationParameters);
         }
         else
         {
             throw new Exception(string.Format("Unknown status code from CheckCooperativeLevel: {0}", status));
         }
     }
 }
 public void Present()
 {
     d3dSwapChain.Present();
 }