Enabled vsync in SwapChain11.

TRAC #22505

Signed-off-by: Jamie Madill
Signed-off-by: Shannon Woods
Author: Geoff Lang

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1849 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/SwapChain11.cpp b/src/libGLESv2/renderer/SwapChain11.cpp
index 61832c3..fa356fb 100644
--- a/src/libGLESv2/renderer/SwapChain11.cpp
+++ b/src/libGLESv2/renderer/SwapChain11.cpp
@@ -40,6 +40,7 @@
     mPassThroughPS = NULL;
     mWidth = -1;
     mHeight = -1;
+    mSwapInterval = 0;
     mAppCreatedShareHandle = mShareHandle != NULL;
 }
 
@@ -193,6 +194,13 @@
         mDepthStencilDSView = NULL;
     }
 
+    mSwapInterval = static_cast<unsigned int>(swapInterval);
+    if (mSwapInterval > 4)
+    {
+        // IDXGISwapChain::Present documentation states that valid sync intervals are in the [0,4] range
+        return EGL_BAD_PARAMETER;
+    }
+
     // If the app passed in a share handle, open the resource
     // See EGL_ANGLE_d3d_share_handle_client_buffer
     if (mAppCreatedShareHandle)
@@ -528,7 +536,7 @@
 
     // Draw
     deviceContext->Draw(4, 0);
-    mSwapChain->Present(0, 0);
+    mSwapChain->Present(mSwapInterval, 0);
 
     // Unbind
     static ID3D11ShaderResourceView *const nullSRV = NULL;