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.
This commit is contained in:
Stefan Dösinger 2008-12-15 19:38:48 +01:00 committed by Alexandre Julliard
parent 1deafcb5a7
commit 365e1f3b07
5 changed files with 12 additions and 7 deletions

View File

@ -1142,7 +1142,7 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
checkGLcall("glDisable GL_DEPTH_TEST"); checkGLcall("glDisable GL_DEPTH_TEST");
Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_ZENABLE), StateTable); Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_ZENABLE), StateTable);
glDisable(GL_FOG); glDisableWINE(GL_FOG);
checkGLcall("glDisable GL_FOG"); checkGLcall("glDisable GL_FOG");
Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_FOGENABLE), StateTable); Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_FOGENABLE), StateTable);
glDisable(GL_BLEND); glDisable(GL_BLEND);

View File

@ -4215,6 +4215,9 @@ BOOL InitAdapters(void) {
glFlush = (void*)pwglGetProcAddress("wglFlush"); glFlush = (void*)pwglGetProcAddress("wglFlush");
#endif #endif
glEnableWINE = glEnable;
glDisableWINE = glDisable;
/* For now only one default adapter */ /* For now only one default adapter */
{ {
int iPixelFormat; int iPixelFormat;

View File

@ -439,14 +439,14 @@ void add_gl_compat_wrappers(WineD3D_GL_Info *gl_info) {
if(old_fogcoord_glEnable) { if(old_fogcoord_glEnable) {
FIXME("GL_EXT_fogcoord glEnable hook already applied\n"); FIXME("GL_EXT_fogcoord glEnable hook already applied\n");
} else { } else {
old_fogcoord_glEnable = glEnable; old_fogcoord_glEnable = glEnableWINE;
glEnable = wine_glEnable; glEnableWINE = wine_glEnable;
} }
if(old_fogcoord_glDisable) { if(old_fogcoord_glDisable) {
FIXME("GL_EXT_fogcoord glDisable hook already applied\n"); FIXME("GL_EXT_fogcoord glDisable hook already applied\n");
} else { } else {
old_fogcoord_glDisable = glDisable; old_fogcoord_glDisable = glDisableWINE;
glDisable = wine_glDisable; glDisableWINE = wine_glDisable;
} }
if(old_fogcoord_glVertex4f) { if(old_fogcoord_glVertex4f) {

View File

@ -983,7 +983,7 @@ void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
if (!stateblock->renderState[WINED3DRS_FOGENABLE]) { if (!stateblock->renderState[WINED3DRS_FOGENABLE]) {
/* No fog? Disable it, and we're done :-) */ /* No fog? Disable it, and we're done :-) */
glDisable(GL_FOG); glDisableWINE(GL_FOG);
checkGLcall("glDisable GL_FOG"); checkGLcall("glDisable GL_FOG");
return; return;
} }
@ -1112,7 +1112,7 @@ void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
} }
} }
glEnable(GL_FOG); glEnableWINE(GL_FOG);
checkGLcall("glEnable GL_FOG"); checkGLcall("glEnable GL_FOG");
if(new_source != context->fog_source) { if(new_source != context->fog_source) {
context->fog_source = new_source; context->fog_source = new_source;

View File

@ -866,6 +866,7 @@ void (WINE_GLAPI *glDepthFunc) (GLenum func);
void (WINE_GLAPI *glDepthMask) (GLboolean flag); void (WINE_GLAPI *glDepthMask) (GLboolean flag);
void (WINE_GLAPI *glDepthRange) (GLclampd nearParam, GLclampd farParam); void (WINE_GLAPI *glDepthRange) (GLclampd nearParam, GLclampd farParam);
void (WINE_GLAPI *glDisable) (GLenum cap); void (WINE_GLAPI *glDisable) (GLenum cap);
void (WINE_GLAPI *glDisableWINE) (GLenum cap);
void (WINE_GLAPI *glDisableClientState) (GLenum array); void (WINE_GLAPI *glDisableClientState) (GLenum array);
void (WINE_GLAPI *glDrawArrays) (GLenum mode, GLint first, GLsizei count); void (WINE_GLAPI *glDrawArrays) (GLenum mode, GLint first, GLsizei count);
void (WINE_GLAPI *glDrawBuffer) (GLenum mode); 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 *glEdgeFlagPointer) (GLsizei stride, const GLvoid* pointer);
void (WINE_GLAPI *glEdgeFlagv) (const GLboolean* flag); void (WINE_GLAPI *glEdgeFlagv) (const GLboolean* flag);
void (WINE_GLAPI *glEnable) (GLenum cap); void (WINE_GLAPI *glEnable) (GLenum cap);
void (WINE_GLAPI *glEnableWINE) (GLenum cap);
void (WINE_GLAPI *glEnableClientState) (GLenum array); void (WINE_GLAPI *glEnableClientState) (GLenum array);
void (WINE_GLAPI *glEnd) (); void (WINE_GLAPI *glEnd) ();
void (WINE_GLAPI *glEndList) (); void (WINE_GLAPI *glEndList) ();