Stefan Dösinger : wined3d: Avoid hooking non-fog glEnable/glDisable calls.

Alexandre Julliard julliard at winehq.org
Mon Jan 12 10:40:32 CST 2009


Module: wine
Branch: master
Commit: 365e1f3b075a044328784d12a3a992dc493e8d71
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=365e1f3b075a044328784d12a3a992dc493e8d71

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Dec 15 19:38:48 2008 +0100

wined3d: Avoid hooking non-fog glEnable/glDisable calls.

This prevents fallout from the GL_EXT_fog_coord emulation. glEnable
and glDisable calls other than those that change GL_FOG are not
hooked. The glEnableWINE and glDisableWINE functions can be used to
add other hooks too if ever needed.

---

 dlls/wined3d/context.c    |    2 +-
 dlls/wined3d/directx.c    |    3 +++
 dlls/wined3d/gl_compat.c  |    8 ++++----
 dlls/wined3d/state.c      |    4 ++--
 dlls/wined3d/wined3d_gl.h |    2 ++
 5 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index c0d65ba..da3053a 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1142,7 +1142,7 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex
     glDisable(GL_DEPTH_TEST);
     checkGLcall("glDisable GL_DEPTH_TEST");
     Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_ZENABLE), StateTable);
-    glDisable(GL_FOG);
+    glDisableWINE(GL_FOG);
     checkGLcall("glDisable GL_FOG");
     Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_FOGENABLE), StateTable);
     glDisable(GL_BLEND);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index b9a63ab..940bb6d 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4215,6 +4215,9 @@ BOOL InitAdapters(void) {
     glFlush = (void*)pwglGetProcAddress("wglFlush");
 #endif
 
+    glEnableWINE = glEnable;
+    glDisableWINE = glDisable;
+
     /* For now only one default adapter */
     {
         int iPixelFormat;
diff --git a/dlls/wined3d/gl_compat.c b/dlls/wined3d/gl_compat.c
index 466b003..1fc48cc 100644
--- a/dlls/wined3d/gl_compat.c
+++ b/dlls/wined3d/gl_compat.c
@@ -439,14 +439,14 @@ void add_gl_compat_wrappers(WineD3D_GL_Info *gl_info) {
         if(old_fogcoord_glEnable) {
             FIXME("GL_EXT_fogcoord glEnable hook already applied\n");
         } else {
-            old_fogcoord_glEnable = glEnable;
-            glEnable = wine_glEnable;
+            old_fogcoord_glEnable = glEnableWINE;
+            glEnableWINE = wine_glEnable;
         }
         if(old_fogcoord_glDisable) {
             FIXME("GL_EXT_fogcoord glDisable hook already applied\n");
         } else {
-            old_fogcoord_glDisable = glDisable;
-            glDisable = wine_glDisable;
+            old_fogcoord_glDisable = glDisableWINE;
+            glDisableWINE = wine_glDisable;
         }
 
         if(old_fogcoord_glVertex4f) {
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index ae9bad4..0c84a50 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -983,7 +983,7 @@ void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
 
     if (!stateblock->renderState[WINED3DRS_FOGENABLE]) {
         /* No fog? Disable it, and we're done :-) */
-        glDisable(GL_FOG);
+        glDisableWINE(GL_FOG);
         checkGLcall("glDisable GL_FOG");
         return;
     }
@@ -1112,7 +1112,7 @@ void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
         }
     }
 
-    glEnable(GL_FOG);
+    glEnableWINE(GL_FOG);
     checkGLcall("glEnable GL_FOG");
     if(new_source != context->fog_source) {
         context->fog_source = new_source;
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 09080a4..07ca0d5 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -866,6 +866,7 @@ void (WINE_GLAPI *glDepthFunc) (GLenum func);
 void (WINE_GLAPI *glDepthMask) (GLboolean flag);
 void (WINE_GLAPI *glDepthRange) (GLclampd nearParam, GLclampd farParam);
 void (WINE_GLAPI *glDisable) (GLenum cap);
+void (WINE_GLAPI *glDisableWINE) (GLenum cap);
 void (WINE_GLAPI *glDisableClientState) (GLenum array);
 void (WINE_GLAPI *glDrawArrays) (GLenum mode, GLint first, GLsizei count);
 void (WINE_GLAPI *glDrawBuffer) (GLenum mode);
@@ -875,6 +876,7 @@ void (WINE_GLAPI *glEdgeFlag) (GLboolean flag);
 void (WINE_GLAPI *glEdgeFlagPointer) (GLsizei stride, const GLvoid* pointer);
 void (WINE_GLAPI *glEdgeFlagv) (const GLboolean* flag);
 void (WINE_GLAPI *glEnable) (GLenum cap);
+void (WINE_GLAPI *glEnableWINE) (GLenum cap);
 void (WINE_GLAPI *glEnableClientState) (GLenum array);
 void (WINE_GLAPI *glEnd) ();
 void (WINE_GLAPI *glEndList) ();




More information about the wine-cvs mailing list