[PATCH] WineD3D: Avoid hooking non-fog glEnable/glDisable calls=0A=

Stefan Doesinger stefan at codeweavers.com
Mon Dec 15 19:38:48 CST 2008

This prevents fallout from the GL_EXT_fog_coord emulation. glEnable and =
glDisable calls other=0A=
than those that change GL_FOG are not hooked. The glEnableWINE and =
glDisableWINE functions can=0A=
be used to add other hooks too if ever needed, I don't plan to add a =
special glEnable/glDisable=0A=
for everything.=0A=
 dlls/wined3d/context.c    |    2 +-=0A=
 dlls/wined3d/directx.c    |    3 +++=0A=
 dlls/wined3d/gl_compat.c  |    8 ++++----=0A=
 dlls/wined3d/state.c      |    4 ++--=0A=
 dlls/wined3d/wined3d_gl.h |    2 ++=0A=
 5 files changed, 12 insertions(+), 7 deletions(-)=0A=
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c=0A=
index c0d65ba..da3053a 100644=0A=
--- a/dlls/wined3d/context.c=0A=
+++ b/dlls/wined3d/context.c=0A=
@@ -1142,7 +1142,7 @@ static inline void SetupForBlit(IWineD3DDeviceImpl =
*This, WineD3DContext *contex=0A=
     checkGLcall("glDisable GL_DEPTH_TEST");=0A=
     Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_ZENABLE), =
-    glDisable(GL_FOG);=0A=
+    glDisableWINE(GL_FOG);=0A=
     checkGLcall("glDisable GL_FOG");=0A=
     Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_FOGENABLE), =
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c=0A=
index 639b07e..117aac8 100644=0A=
--- a/dlls/wined3d/directx.c=0A=
+++ b/dlls/wined3d/directx.c=0A=
@@ -4207,6 +4207,9 @@ BOOL InitAdapters(void) {=0A=
     glFlush =3D (void*)pwglGetProcAddress("wglFlush");=0A=
+    glEnableWINE =3D glEnable;=0A=
+    glDisableWINE =3D glDisable;=0A=
     /* For now only one default adapter */=0A=
         int iPixelFormat;=0A=
diff --git a/dlls/wined3d/gl_compat.c b/dlls/wined3d/gl_compat.c=0A=
index 466b003..1fc48cc 100644=0A=
--- a/dlls/wined3d/gl_compat.c=0A=
+++ b/dlls/wined3d/gl_compat.c=0A=
@@ -439,14 +439,14 @@ void add_gl_compat_wrappers(WineD3D_GL_Info =
*gl_info) {=0A=
         if(old_fogcoord_glEnable) {=0A=
             FIXME("GL_EXT_fogcoord glEnable hook already applied\n");=0A=
         } else {=0A=
-            old_fogcoord_glEnable =3D glEnable;=0A=
-            glEnable =3D wine_glEnable;=0A=
+            old_fogcoord_glEnable =3D glEnableWINE;=0A=
+            glEnableWINE =3D wine_glEnable;=0A=
         if(old_fogcoord_glDisable) {=0A=
             FIXME("GL_EXT_fogcoord glDisable hook already applied\n");=0A=
         } else {=0A=
-            old_fogcoord_glDisable =3D glDisable;=0A=
-            glDisable =3D wine_glDisable;=0A=
+            old_fogcoord_glDisable =3D glDisableWINE;=0A=
+            glDisableWINE =3D wine_glDisable;=0A=
         if(old_fogcoord_glVertex4f) {=0A=
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c=0A=
index 5beadbf..abe8ba0 100644=0A=
--- a/dlls/wined3d/state.c=0A=
+++ b/dlls/wined3d/state.c=0A=
@@ -983,7 +983,7 @@ void state_fog_fragpart(DWORD state, =
IWineD3DStateBlockImpl *stateblock, WineD3D=0A=
     if (!stateblock->renderState[WINED3DRS_FOGENABLE]) {=0A=
         /* No fog? Disable it, and we're done :-) */=0A=
-        glDisable(GL_FOG);=0A=
+        glDisableWINE(GL_FOG);=0A=
         checkGLcall("glDisable GL_FOG");=0A=
@@ -1112,7 +1112,7 @@ void state_fog_fragpart(DWORD state, =
IWineD3DStateBlockImpl *stateblock, WineD3D=0A=
-    glEnable(GL_FOG);=0A=
+    glEnableWINE(GL_FOG);=0A=
     checkGLcall("glEnable GL_FOG");=0A=
     if(new_source !=3D context->fog_source) {=0A=
         context->fog_source =3D new_source;=0A=
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h=0A=
index 09080a4..07ca0d5 100644=0A=
--- a/dlls/wined3d/wined3d_gl.h=0A=
+++ b/dlls/wined3d/wined3d_gl.h=0A=
@@ -866,6 +866,7 @@ void (WINE_GLAPI *glDepthFunc) (GLenum func);=0A=
 void (WINE_GLAPI *glDepthMask) (GLboolean flag);=0A=
 void (WINE_GLAPI *glDepthRange) (GLclampd nearParam, GLclampd farParam);=0A=
 void (WINE_GLAPI *glDisable) (GLenum cap);=0A=
+void (WINE_GLAPI *glDisableWINE) (GLenum cap);=0A=
 void (WINE_GLAPI *glDisableClientState) (GLenum array);=0A=
 void (WINE_GLAPI *glDrawArrays) (GLenum mode, GLint first, GLsizei =
 void (WINE_GLAPI *glDrawBuffer) (GLenum mode);=0A=
@@ -875,6 +876,7 @@ void (WINE_GLAPI *glEdgeFlag) (GLboolean flag);=0A=
 void (WINE_GLAPI *glEdgeFlagPointer) (GLsizei stride, const GLvoid* =
 void (WINE_GLAPI *glEdgeFlagv) (const GLboolean* flag);=0A=
 void (WINE_GLAPI *glEnable) (GLenum cap);=0A=
+void (WINE_GLAPI *glEnableWINE) (GLenum cap);=0A=
 void (WINE_GLAPI *glEnableClientState) (GLenum array);=0A=
 void (WINE_GLAPI *glEnd) ();=0A=
 void (WINE_GLAPI *glEndList) ();=0A=
-- =0A=


More information about the wine-patches mailing list