Commit 1d4effca authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wgl: Fix WoW screen flickering.

parent 4c4094e8
......@@ -199,6 +199,7 @@ static struct graphics_driver *create_driver( HMODULE module )
GET_FUNC(wglCreateContext);
GET_FUNC(wglDeleteContext);
GET_FUNC(wglGetProcAddress);
GET_FUNC(wglGetPbufferDCARB);
GET_FUNC(wglMakeContextCurrentARB);
GET_FUNC(wglMakeCurrent);
GET_FUNC(wglShareLists);
......
......@@ -187,6 +187,7 @@ typedef struct tagDC_FUNCS
HGLRC (*pwglCreateContext)(PHYSDEV);
BOOL (*pwglDeleteContext)(HGLRC);
PROC (*pwglGetProcAddress)(LPCSTR);
HDC (*pwglGetPbufferDCARB)(PHYSDEV, void*);
BOOL (*pwglMakeCurrent)(PHYSDEV, HGLRC);
BOOL (*pwglMakeContextCurrentARB)(PHYSDEV, PHYSDEV, HGLRC);
BOOL (*pwglShareLists)(HGLRC hglrc1, HGLRC hglrc2);
......
......@@ -131,6 +131,33 @@ HDC WINAPI wglGetCurrentDC(void)
}
/***********************************************************************
* wglGetPbufferDCARB
*/
static HDC WINAPI wglGetPbufferDCARB(void *pbuffer)
{
HDC ret = 0;
/* Create a device context to associate with the pbuffer */
HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
DC *dc = DC_GetDCPtr(hdc);
TRACE("(%p)\n", pbuffer);
if (!dc) return FALSE;
/* The display driver has to do the rest of the work because
* we need access to lowlevel datatypes which we can't access here
*/
if (!dc->funcs->pwglGetPbufferDCARB) FIXME(" :stub\n");
else ret = dc->funcs->pwglGetPbufferDCARB(dc->physDev, pbuffer);
TRACE("(%p), hdc=%p\n", pbuffer, ret);
GDI_ReleaseObj(hdc);
return ret;
}
/***********************************************************************
* wglMakeCurrent (OPENGL32.@)
*/
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
......@@ -281,6 +308,8 @@ PROC WINAPI wglGetProcAddress(LPCSTR func)
*/
if(ret && strcmp(func, "wglMakeContextCurrentARB") == 0)
return wglMakeContextCurrentARB;
else if(ret && strcmp(func, "wglGetPbufferDCARB") == 0)
return (PROC)wglGetPbufferDCARB;
return ret;
}
......@@ -1871,23 +1871,26 @@ static GLboolean WINAPI X11DRV_wglDestroyPbufferARB(HPBUFFERARB hPbuffer)
return GL_TRUE;
}
/* WGL_ARB_pbuffer: wglGetPbufferDCARB */
static HDC WINAPI X11DRV_wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
/* WGL_ARB_pbuffer: wglGetPbufferDCARB
* The function wglGetPbufferDCARB returns a device context for a pbuffer.
* Gdi32 implements the part of this function which creates a device context.
* This part associates the physDev with the X drawable of the pbuffer.
*/
HDC X11DRV_wglGetPbufferDCARB(X11DRV_PDEVICE *physDev, HPBUFFERARB hPbuffer)
{
Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
HDC hDC;
if (NULL == object) {
SetLastError(ERROR_INVALID_HANDLE);
return NULL;
}
hDC = CreateCompatibleDC(object->hdc);
/* The function wglGetPbufferDCARB returns a DC to which the pbuffer can be connected.
* We only support one onscreen rendering format (the one from the main visual), so use that. */
SetPixelFormat(hDC, 1, NULL);
set_drawable(hDC, object->drawable); /* works ?? */
TRACE("(%p)->(%p)\n", hPbuffer, hDC);
return hDC;
physDev->current_pf = 1;
physDev->drawable = object->drawable;
TRACE("(%p)->(%p)\n", hPbuffer, physDev->hdc);
return physDev->hdc;
}
/* WGL_ARB_pbuffer: wglQueryPbufferARB */
......@@ -2379,6 +2382,9 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf
SetLastError(ERROR_INVALID_HANDLE);
return GL_FALSE;
}
/* Disable WGL_ARB_render_texture support untill it is implemented properly
* using pbuffers or FBOs */
#if 0
if (!use_render_texture_ati && 1 == use_render_texture_emulation) {
int do_init = 0;
GLint prev_binded_tex;
......@@ -2406,6 +2412,7 @@ static GLboolean WINAPI X11DRV_wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuf
object->texture = prev_binded_tex;
return GL_TRUE;
}
#endif
if (NULL != pglXBindTexImageARB) {
return pglXBindTexImageARB(object->display, object->drawable, iBuffer);
}
......@@ -2834,6 +2841,12 @@ PROC X11DRV_wglGetProcAddress(LPCSTR lpszProc) {
return NULL;
}
HDC X11DRV_wglGetPbufferDCARB(X11DRV_PDEVICE *hDevice, HPBUFFERARB hPbuffer)
{
ERR_(opengl)("No OpenGL support compiled in.\n");
return NULL;
}
BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* hDrawDev, X11DRV_PDEVICE* hReadDev, HGLRC hglrc) {
ERR_(opengl)("No OpenGL support compiled in.\n");
return FALSE;
......
......@@ -134,6 +134,7 @@
@ cdecl wglCreateContext(ptr) X11DRV_wglCreateContext
@ cdecl wglDeleteContext(long) X11DRV_wglDeleteContext
@ cdecl wglGetProcAddress(str) X11DRV_wglGetProcAddress
@ cdecl wglGetPbufferDCARB(ptr ptr) X11DRV_wglGetPbufferDCARB
@ cdecl wglMakeContextCurrentARB(ptr ptr long) X11DRV_wglMakeContextCurrentARB
@ cdecl wglMakeCurrent(ptr long) X11DRV_wglMakeCurrent
@ cdecl wglShareLists(long long) X11DRV_wglShareLists
......
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