[PATCH 1/6] wined3d: Remove the remains of an ATI_fragment_shader hack.

Henri Verbeet hverbeet at codeweavers.com
Wed Jul 15 05:21:16 CDT 2009


This was originally added as a workaround for a Mesa bug by commit
ddf52dda15e83eae639ef2ce0ec4071b321ce34f. The other half of the hack has since
been removed. This code causes problems when wglDeleteContext() from a
different thread causes our current context to be destroyed, since
wglGetCurrentContext() will return a destroyed context in that case. That is a
flaw in our wgl implementation, since wglDeleteContext() shouldn't allow a
context that's current in a different thread to be destroyed, but this hack is
a bad idea regardless.
---
 dlls/wined3d/context.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 6971e68..577f235 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -791,11 +791,11 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
  *
  *****************************************************************************/
 WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win_handle, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms) {
-    HDC oldDrawable, hdc;
     HPBUFFERARB pbuffer = NULL;
-    HGLRC ctx = NULL, oldCtx;
     WineD3DContext *ret = NULL;
     unsigned int s;
+    HGLRC ctx;
+    HDC hdc;
 
     TRACE("(%p): Creating a %s context for render target %p\n", This, create_pbuffer ? "offscreen" : "onscreen", target);
 
@@ -984,12 +984,6 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
     list_init(&ret->fbo_list);
 
     /* Set up the context defaults */
-    oldCtx  = pwglGetCurrentContext();
-    oldDrawable = pwglGetCurrentDC();
-    if(oldCtx && oldDrawable) {
-        /* See comment in ActivateContext context switching */
-        This->frag_pipe->enable_extension((IWineD3DDevice *) This, FALSE);
-    }
     if(pwglMakeCurrent(hdc, ctx) == FALSE) {
         ERR("Cannot activate context to set up defaults\n");
         goto out;
@@ -1074,17 +1068,7 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
     }
     LEAVE_GL();
 
-    /* Never keep GL_FRAGMENT_SHADER_ATI enabled on a context that we switch away from,
-     * but enable it for the first context we create, and reenable it on the old context
-     */
-    if(oldDrawable && oldCtx) {
-        if (!pwglMakeCurrent(oldDrawable, oldCtx))
-        {
-            ERR("Failed to make previous GL context %p current.\n", oldCtx);
-        }
-    } else {
-        context_set_last_device(This);
-    }
+    context_set_last_device(This);
     This->frag_pipe->enable_extension((IWineD3DDevice *) This, TRUE);
 
     return ret;
-- 
1.6.0.6




More information about the wine-patches mailing list