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
parent 3de0a453
......@@ -40,6 +40,7 @@ SwapChain11::SwapChain11(Renderer11 *renderer, HWND window, HANDLE shareHandle,
mPassThroughPS = NULL;
mWidth = -1;
mHeight = -1;
mSwapInterval = 0;
mAppCreatedShareHandle = mShareHandle != NULL;
}
......@@ -193,6 +194,13 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
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 @@ EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
// Draw
deviceContext->Draw(4, 0);
mSwapChain->Present(0, 0);
mSwapChain->Present(mSwapInterval, 0);
// Unbind
static ID3D11ShaderResourceView *const nullSRV = NULL;
......
......@@ -48,6 +48,7 @@ class SwapChain11 : public SwapChain
EGLint mHeight;
EGLint mWidth;
bool mAppCreatedShareHandle;
unsigned int mSwapInterval;
IDXGISwapChain *mSwapChain;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment