wined3d: Handle the swapchain presentation interval with wglSwapIntervalEXT.

This commit is contained in:
Andrew Nguyen 2010-12-27 06:44:21 -06:00 committed by Alexandre Julliard
parent a7346e9fc8
commit 12880784fe
3 changed files with 40 additions and 1 deletions

View File

@ -1280,6 +1280,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain,
int numSamples = 0;
int pixel_format;
unsigned int s;
int swap_interval;
DWORD state;
HGLRC ctx;
HDC hdc;
@ -1460,6 +1461,36 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain,
goto out;
}
switch (swapchain->presentParms.PresentationInterval)
{
case WINED3DPRESENT_INTERVAL_IMMEDIATE:
swap_interval = 0;
break;
case WINED3DPRESENT_INTERVAL_DEFAULT:
case WINED3DPRESENT_INTERVAL_ONE:
swap_interval = 1;
break;
case WINED3DPRESENT_INTERVAL_TWO:
swap_interval = 2;
break;
case WINED3DPRESENT_INTERVAL_THREE:
swap_interval = 3;
break;
case WINED3DPRESENT_INTERVAL_FOUR:
swap_interval = 4;
break;
default:
FIXME("Unknown presentation interval %08x\n", swapchain->presentParms.PresentationInterval);
swap_interval = 1;
}
if (gl_info->supported[WGL_EXT_SWAP_CONTROL])
{
if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval)))
ERR("wglSwapIntervalEXT failed to set swap interval %d for context %p, last error %#x\n",
swap_interval, ret, GetLastError());
}
ENTER_GL();
glGetIntegerv(GL_AUX_BUFFERS, &ret->aux_buffers);

View File

@ -2572,6 +2572,10 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter)
gl_info->supported[WGL_ARB_PIXEL_FORMAT] = TRUE;
TRACE_(d3d_caps)("FOUND: WGL_ARB_pixel_format support\n");
}
if (!strcmp(ThisExtn, "WGL_EXT_swap_control")) {
gl_info->supported[WGL_EXT_SWAP_CONTROL] = TRUE;
TRACE_(d3d_caps)("FOUND: WGL_EXT_swap_control support\n");
}
if (!strcmp(ThisExtn, "WGL_WINE_pixel_format_passthrough")) {
gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH] = TRUE;
TRACE_(d3d_caps)("FOUND: WGL_WINE_pixel_format_passthrough support\n");

View File

@ -1836,6 +1836,7 @@ typedef enum wined3d_gl_extension
SGIS_GENERATE_MIPMAP,
/* WGL extensions */
WGL_ARB_PIXEL_FORMAT,
WGL_EXT_SWAP_CONTROL,
WGL_WINE_PIXEL_FORMAT_PASSTHROUGH,
/* Internally used */
WINED3D_GL_NORMALIZED_TEXRECT,
@ -3796,6 +3797,8 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLCHOOSEPIXELFORMATARBPROC)(HDC hdc, const int
typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd);
typedef BOOL (WINAPI *WINED3D_PFNWGLSWAPINTERVALEXTPROC)(int interval);
#define GL_EXT_FUNCS_GEN \
/* GL_APPLE_fence */ \
USE_GL_FUNC(PGLFNGENFENCESAPPLEPROC, \
@ -4531,6 +4534,7 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma
USE_GL_FUNC(WINED3D_PFNWGLGETPIXELFORMATATTRIBIVARBPROC, wglGetPixelFormatAttribivARB, 0, NULL) \
USE_GL_FUNC(WINED3D_PFNWGLGETPIXELFORMATATTRIBFVARBPROC, wglGetPixelFormatAttribfvARB, 0, NULL) \
USE_GL_FUNC(WINED3D_PFNWGLCHOOSEPIXELFORMATARBPROC, wglChoosePixelFormatARB, 0, NULL) \
USE_GL_FUNC(WINED3D_PFNWGLSETPIXELFORMATWINE, wglSetPixelFormatWINE, 0, NULL)
USE_GL_FUNC(WINED3D_PFNWGLSETPIXELFORMATWINE, wglSetPixelFormatWINE, 0, NULL) \
USE_GL_FUNC(WINED3D_PFNWGLSWAPINTERVALEXTPROC, wglSwapIntervalEXT, 0, NULL)
#endif /* __WINE_WINED3D_GL */