wined3d: Move shader limits to wined3d_d3d_info.
[wine] / dlls / wined3d / gl_compat.c
1 /*
2  * Compatibility functions for older GL implementations
3  *
4  * Copyright 2008 Stefan Dösinger for CodeWeavers
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22 #include "wine/port.h"
23
24 #include <stdio.h>
25 #ifdef HAVE_FLOAT_H
26 # include <float.h>
27 #endif
28
29 #include "wined3d_private.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(gl_compat);
32 WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
33
34 /* Start GL_ARB_multitexture emulation */
35 static void WINE_GLAPI wine_glMultiTexCoord1fARB(GLenum target, GLfloat s) {
36     if(target != GL_TEXTURE0) {
37         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
38         return;
39     }
40     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord1f(s);
41 }
42
43 static void WINE_GLAPI wine_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) {
44     if(target != GL_TEXTURE0) {
45         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
46         return;
47     }
48     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord1fv(v);
49 }
50
51 static void WINE_GLAPI wine_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) {
52     if(target != GL_TEXTURE0) {
53         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
54         return;
55     }
56     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2f(s, t);
57 }
58
59 static void WINE_GLAPI wine_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) {
60     if(target != GL_TEXTURE0) {
61         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
62         return;
63     }
64     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2fv(v);
65 }
66
67 static void WINE_GLAPI wine_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) {
68     if(target != GL_TEXTURE0) {
69         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
70         return;
71     }
72     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord3f(s, t, r);
73 }
74
75 static void WINE_GLAPI wine_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) {
76     if(target != GL_TEXTURE0) {
77         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
78         return;
79     }
80     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord3fv(v);
81 }
82
83 static void WINE_GLAPI wine_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
84     if(target != GL_TEXTURE0) {
85         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
86         return;
87     }
88     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4f(s, t, r, q);
89 }
90
91 static void WINE_GLAPI wine_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) {
92     if(target != GL_TEXTURE0) {
93         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
94         return;
95     }
96     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4fv(v);
97 }
98
99 static void WINE_GLAPI wine_glMultiTexCoord2svARB(GLenum target, const GLshort *v) {
100     if(target != GL_TEXTURE0) {
101         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
102         return;
103     }
104     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2sv(v);
105 }
106
107 static void WINE_GLAPI wine_glMultiTexCoord4svARB(GLenum target, const GLshort *v) {
108     if(target != GL_TEXTURE0) {
109         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
110         return;
111     }
112     context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4sv(v);
113 }
114
115 static void WINE_GLAPI wine_glActiveTextureARB(GLenum texture) {
116     if(texture != GL_TEXTURE0) {
117         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
118         return;
119     }
120 }
121
122 static void WINE_GLAPI wine_glClientActiveTextureARB(GLenum texture) {
123     if(texture != GL_TEXTURE0) {
124         ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
125         return;
126     }
127 }
128
129 static void (WINE_GLAPI *old_multitex_glGetIntegerv) (GLenum pname, GLint* params) = NULL;
130 static void WINE_GLAPI wine_glGetIntegerv(GLenum pname, GLint* params) {
131     switch(pname) {
132         case GL_ACTIVE_TEXTURE:         *params = 0;    break;
133         case GL_MAX_TEXTURE_UNITS_ARB:  *params = 1;    break;
134         default: old_multitex_glGetIntegerv(pname, params);
135     }
136 }
137
138 static void (WINE_GLAPI *old_multitex_glGetFloatv) (GLenum pname, GLfloat* params) = NULL;
139 static void WINE_GLAPI wine_glGetFloatv(GLenum pname, GLfloat* params) {
140     if (pname == GL_ACTIVE_TEXTURE) *params = 0.0f;
141     else old_multitex_glGetFloatv(pname, params);
142 }
143
144 static void (WINE_GLAPI *old_multitex_glGetDoublev) (GLenum pname, GLdouble* params) = NULL;
145 static void WINE_GLAPI wine_glGetDoublev(GLenum pname, GLdouble* params) {
146     if(pname == GL_ACTIVE_TEXTURE) *params = 0.0;
147     else old_multitex_glGetDoublev(pname, params);
148 }
149
150 /* Start GL_EXT_fogcoord emulation */
151 static void (WINE_GLAPI *old_fogcoord_glEnable) (GLenum cap) = NULL;
152 static void WINE_GLAPI wine_glEnable(GLenum cap) {
153     if(cap == GL_FOG) {
154         struct wined3d_context *ctx = context_get_current();
155         ctx->fog_enabled = 1;
156         if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
157     }
158     old_fogcoord_glEnable(cap);
159 }
160
161 static void (WINE_GLAPI *old_fogcoord_glDisable) (GLenum cap) = NULL;
162 static void WINE_GLAPI wine_glDisable(GLenum cap) {
163     if(cap == GL_FOG) {
164         struct wined3d_context *ctx = context_get_current();
165         ctx->fog_enabled = 0;
166         if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
167     }
168     old_fogcoord_glDisable(cap);
169 }
170
171 static void (WINE_GLAPI *old_fogcoord_glFogi) (GLenum pname, GLint param) = NULL;
172 static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) {
173     struct wined3d_context *ctx = context_get_current();
174
175     if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
176         ctx->gl_fog_source = param;
177         if(param == GL_FRAGMENT_DEPTH_EXT) {
178             if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
179         } else {
180             WARN_(d3d_perf)("Fog coords activated, but not supported. Using slow emulation\n");
181             old_fogcoord_glDisable(GL_FOG);
182         }
183     } else {
184         if(pname == GL_FOG_START) {
185             ctx->fogstart = (float) param;
186         } else if(pname == GL_FOG_END) {
187             ctx->fogend = (float) param;
188         }
189         old_fogcoord_glFogi(pname, param);
190     }
191 }
192
193 static void (WINE_GLAPI *old_fogcoord_glFogiv) (GLenum pname, const GLint *param) = NULL;
194 static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) {
195     struct wined3d_context *ctx = context_get_current();
196     if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
197         ctx->gl_fog_source = *param;
198         if(*param == GL_FRAGMENT_DEPTH_EXT) {
199             if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
200         } else {
201             WARN_(d3d_perf)("Fog coords activated, but not supported. Using slow emulation\n");
202             old_fogcoord_glDisable(GL_FOG);
203         }
204     } else {
205         if(pname == GL_FOG_START) {
206             ctx->fogstart = (float) *param;
207         } else if(pname == GL_FOG_END) {
208             ctx->fogend = (float) *param;
209         }
210         old_fogcoord_glFogiv(pname, param);
211     }
212 }
213
214 static void (WINE_GLAPI *old_fogcoord_glFogf) (GLenum pname, GLfloat param) = NULL;
215 static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) {
216     struct wined3d_context *ctx = context_get_current();
217     if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
218         ctx->gl_fog_source = (GLint) param;
219         if(param == GL_FRAGMENT_DEPTH_EXT) {
220             if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
221         } else {
222             WARN_(d3d_perf)("Fog coords activated, but not supported. Using slow emulation\n");
223             old_fogcoord_glDisable(GL_FOG);
224         }
225     } else {
226         if(pname == GL_FOG_START) {
227             ctx->fogstart = param;
228         } else if(pname == GL_FOG_END) {
229             ctx->fogend = param;
230         }
231         old_fogcoord_glFogf(pname, param);
232     }
233 }
234
235 static void (WINE_GLAPI *old_fogcoord_glFogfv) (GLenum pname, const GLfloat *param) = NULL;
236 static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) {
237     struct wined3d_context *ctx = context_get_current();
238     if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
239         ctx->gl_fog_source = (GLint) *param;
240         if(*param == GL_FRAGMENT_DEPTH_EXT) {
241             if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
242         } else {
243             WARN_(d3d_perf)("Fog coords activated, but not supported. Using slow emulation\n");
244             old_fogcoord_glDisable(GL_FOG);
245         }
246     } else {
247         if(pname == GL_FOG_COLOR) {
248             ctx->fogcolor[0] = param[0];
249             ctx->fogcolor[1] = param[1];
250             ctx->fogcolor[2] = param[2];
251             ctx->fogcolor[3] = param[3];
252         } else if(pname == GL_FOG_START) {
253             ctx->fogstart = *param;
254         } else if(pname == GL_FOG_END) {
255             ctx->fogend = *param;
256         }
257         old_fogcoord_glFogfv(pname, param);
258     }
259 }
260
261 static void (WINE_GLAPI *old_fogcoord_glVertex4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w) = NULL;
262 static void (WINE_GLAPI *old_fogcoord_glVertex4fv) (const GLfloat *pos) = NULL;
263 static void (WINE_GLAPI *old_fogcoord_glVertex3f) (GLfloat x, GLfloat y, GLfloat z) = NULL;
264 static void (WINE_GLAPI *old_fogcoord_glVertex3fv) (const GLfloat *pos) = NULL;
265 static void (WINE_GLAPI *old_fogcoord_glColor4f) (GLfloat r, GLfloat g, GLfloat b, GLfloat a) = NULL;
266 static void (WINE_GLAPI *old_fogcoord_glColor4fv) (const GLfloat *color) = NULL;
267 static void (WINE_GLAPI *old_fogcoord_glColor3f) (GLfloat r, GLfloat g, GLfloat b) = NULL;
268 static void (WINE_GLAPI *old_fogcoord_glColor3fv) (const GLfloat *color) = NULL;
269 static void (WINE_GLAPI *old_fogcoord_glColor4ub) (GLubyte r, GLubyte g, GLubyte b, GLubyte a) = NULL;
270 static void (WINE_GLAPI *old_fogcoord_glFogCoordfEXT) (GLfloat f) = NULL;
271 static void (WINE_GLAPI *old_fogcoord_glFogCoorddEXT) (GLdouble f) = NULL;
272 static void (WINE_GLAPI *old_fogcoord_glFogCoordfvEXT) (const GLfloat *f) = NULL;
273 static void (WINE_GLAPI *old_fogcoord_glFogCoorddvEXT) (const GLdouble *f) = NULL;
274
275 static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
276     struct wined3d_context *ctx = context_get_current();
277     if(ctx->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx->fog_enabled) {
278         GLfloat c[4] = {ctx->color[0], ctx->color[1], ctx->color[2], ctx->color[3]};
279         GLfloat i;
280
281         i = (ctx->fogend - ctx->fog_coord_value) / (ctx->fogend - ctx->fogstart);
282         c[0] = i * c[0] + (1.0f - i) * ctx->fogcolor[0];
283         c[1] = i * c[1] + (1.0f - i) * ctx->fogcolor[1];
284         c[2] = i * c[2] + (1.0f - i) * ctx->fogcolor[2];
285
286         old_fogcoord_glColor4f(c[0], c[1], c[2], c[3]);
287         old_fogcoord_glVertex4f(x, y, z, w);
288     } else {
289         old_fogcoord_glVertex4f(x, y, z, w);
290     }
291 }
292
293 static void WINE_GLAPI wine_glVertex4fv(const GLfloat *pos) {
294     wine_glVertex4f(pos[0], pos[1], pos[2], pos[3]);
295 }
296
297 static void WINE_GLAPI wine_glVertex3f(GLfloat x, GLfloat y, GLfloat z) {
298     wine_glVertex4f(x, y, z, 1.0f);
299 }
300
301 static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) {
302     wine_glVertex4f(pos[0], pos[1], pos[2], 1.0f);
303 }
304
305 static void WINE_GLAPI wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
306     struct wined3d_context *ctx = context_get_current();
307     ctx->color[0] = r;
308     ctx->color[1] = g;
309     ctx->color[2] = b;
310     ctx->color[3] = a;
311     old_fogcoord_glColor4f(r, g, b, a);
312 }
313
314 static void WINE_GLAPI wine_glColor4fv(const GLfloat *c) {
315     wine_glColor4f(c[0], c[1], c[2], c[3]);
316 }
317
318 static void WINE_GLAPI wine_glColor3f(GLfloat r, GLfloat g, GLfloat b) {
319     wine_glColor4f(r, g, b, 1.0f);
320 }
321
322 static void WINE_GLAPI wine_glColor3fv(const GLfloat *c) {
323     wine_glColor4f(c[0], c[1], c[2], 1.0f);
324 }
325
326 static void WINE_GLAPI wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) {
327     wine_glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
328 }
329
330 /* In D3D the fog coord is a UBYTE, so there's no problem with using the single
331  * precision function
332  */
333 static void WINE_GLAPI wine_glFogCoordfEXT(GLfloat f) {
334     struct wined3d_context *ctx = context_get_current();
335     ctx->fog_coord_value = f;
336 }
337 static void WINE_GLAPI wine_glFogCoorddEXT(GLdouble f) {
338     wine_glFogCoordfEXT((GLfloat) f);
339 }
340 static void WINE_GLAPI wine_glFogCoordfvEXT(const GLfloat *f) {
341     wine_glFogCoordfEXT(*f);
342 }
343 static void WINE_GLAPI wine_glFogCoorddvEXT(const GLdouble *f) {
344     wine_glFogCoordfEXT((GLfloat) *f);
345 }
346
347 /* End GL_EXT_fog_coord emulation */
348
349 void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info)
350 {
351     if (!gl_info->supported[ARB_MULTITEXTURE])
352     {
353         TRACE("Applying GL_ARB_multitexture emulation hooks\n");
354         gl_info->gl_ops.ext.p_glActiveTextureARB        = wine_glActiveTextureARB;
355         gl_info->gl_ops.ext.p_glClientActiveTextureARB  = wine_glClientActiveTextureARB;
356         gl_info->gl_ops.ext.p_glMultiTexCoord1fARB      = wine_glMultiTexCoord1fARB;
357         gl_info->gl_ops.ext.p_glMultiTexCoord1fvARB     = wine_glMultiTexCoord1fvARB;
358         gl_info->gl_ops.ext.p_glMultiTexCoord2fARB      = wine_glMultiTexCoord2fARB;
359         gl_info->gl_ops.ext.p_glMultiTexCoord2fvARB     = wine_glMultiTexCoord2fvARB;
360         gl_info->gl_ops.ext.p_glMultiTexCoord3fARB      = wine_glMultiTexCoord3fARB;
361         gl_info->gl_ops.ext.p_glMultiTexCoord3fvARB     = wine_glMultiTexCoord3fvARB;
362         gl_info->gl_ops.ext.p_glMultiTexCoord4fARB      = wine_glMultiTexCoord4fARB;
363         gl_info->gl_ops.ext.p_glMultiTexCoord4fvARB     = wine_glMultiTexCoord4fvARB;
364         gl_info->gl_ops.ext.p_glMultiTexCoord2svARB     = wine_glMultiTexCoord2svARB;
365         gl_info->gl_ops.ext.p_glMultiTexCoord4svARB     = wine_glMultiTexCoord4svARB;
366         if(old_multitex_glGetIntegerv) {
367             FIXME("GL_ARB_multitexture glGetIntegerv hook already applied\n");
368         } else {
369             old_multitex_glGetIntegerv = gl_info->gl_ops.gl.p_glGetIntegerv;
370             gl_info->gl_ops.gl.p_glGetIntegerv = wine_glGetIntegerv;
371         }
372         if(old_multitex_glGetFloatv) {
373             FIXME("GL_ARB_multitexture glGetGloatv hook already applied\n");
374         } else {
375             old_multitex_glGetFloatv = gl_info->gl_ops.gl.p_glGetFloatv;
376             gl_info->gl_ops.gl.p_glGetFloatv = wine_glGetFloatv;
377         }
378         if(old_multitex_glGetDoublev) {
379             FIXME("GL_ARB_multitexture glGetDoublev hook already applied\n");
380         } else {
381             old_multitex_glGetDoublev = gl_info->gl_ops.gl.p_glGetDoublev;
382             gl_info->gl_ops.gl.p_glGetDoublev = wine_glGetDoublev;
383         }
384         gl_info->supported[ARB_MULTITEXTURE] = TRUE;
385     }
386
387     if (!gl_info->supported[EXT_FOG_COORD])
388     {
389         /* This emulation isn't perfect. There are a number of potential problems, but they should
390          * not matter in practise:
391          *
392          * Fog vs fragment shader: If we are using GL_ARB_fragment_program with the fog option, the
393          * glDisable(GL_FOG) here won't matter. However, if we have GL_ARB_fragment_program, it is pretty
394          * unlikely that we don't have GL_EXT_fog_coord. Besides, we probably have GL_ARB_vertex_program
395          * too, which would allow fog coord emulation in a fixed function vertex pipeline replacement.
396          *
397          * Fog vs texture: We apply the fog in the vertex color. An app could set up texturing settings which
398          * ignore the vertex color, thus effectively disabling our fog. However, in D3D this type of fog is
399          * a per-vertex fog too, so the apps shouldn't do that.
400          *
401          * Fog vs lighting: The app could in theory use D3DFOG_NONE table and D3DFOG_NONE vertex fog with
402          * untransformed vertices. That enables lighting and fog coords at the same time, and the lighting
403          * calculations could affect the already blended in fog color. There's nothing we can do against that,
404          * but most apps using fog color do their own lighting too and often even use RHW vertices. So live
405          * with it.
406          */
407         TRACE("Applying GL_ARB_fog_coord emulation hooks\n");
408
409         /* This probably means that the implementation doesn't advertise the extension, but implicitly supports
410          * it via the GL core version, or someone messed around in the extension table in directx.c. Add version-
411          * dependent loading for this extension if we ever hit this situation
412          */
413         if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
414         {
415             FIXME("GL implementation supports GL_ARB_fragment_program but not GL_EXT_fog_coord\n");
416             FIXME("The fog coord emulation will most likely fail\n");
417         }
418         else if (gl_info->supported[ARB_FRAGMENT_SHADER])
419         {
420             FIXME("GL implementation supports GL_ARB_fragment_shader but not GL_EXT_fog_coord\n");
421             FIXME("The fog coord emulation will most likely fail\n");
422         }
423
424         if(old_fogcoord_glFogi) {
425             FIXME("GL_EXT_fogcoord glFogi hook already applied\n");
426         } else {
427             old_fogcoord_glFogi = gl_info->gl_ops.gl.p_glFogi;
428             gl_info->gl_ops.gl.p_glFogi = wine_glFogi;
429         }
430         if(old_fogcoord_glFogiv) {
431             FIXME("GL_EXT_fogcoord glFogiv hook already applied\n");
432         } else {
433             old_fogcoord_glFogiv = gl_info->gl_ops.gl.p_glFogiv;
434             gl_info->gl_ops.gl.p_glFogiv = wine_glFogiv;
435         }
436         if(old_fogcoord_glFogf) {
437             FIXME("GL_EXT_fogcoord glFogf hook already applied\n");
438         } else {
439             old_fogcoord_glFogf = gl_info->gl_ops.gl.p_glFogf;
440             gl_info->gl_ops.gl.p_glFogf = wine_glFogf;
441         }
442         if(old_fogcoord_glFogfv) {
443             FIXME("GL_EXT_fogcoord glFogfv hook already applied\n");
444         } else {
445             old_fogcoord_glFogfv = gl_info->gl_ops.gl.p_glFogfv;
446             gl_info->gl_ops.gl.p_glFogfv = wine_glFogfv;
447         }
448         if(old_fogcoord_glEnable) {
449             FIXME("GL_EXT_fogcoord glEnable hook already applied\n");
450         } else {
451             old_fogcoord_glEnable = glEnableWINE;
452             glEnableWINE = wine_glEnable;
453         }
454         if(old_fogcoord_glDisable) {
455             FIXME("GL_EXT_fogcoord glDisable hook already applied\n");
456         } else {
457             old_fogcoord_glDisable = glDisableWINE;
458             glDisableWINE = wine_glDisable;
459         }
460
461         if(old_fogcoord_glVertex4f) {
462             FIXME("GL_EXT_fogcoord glVertex4f hook already applied\n");
463         } else {
464             old_fogcoord_glVertex4f = gl_info->gl_ops.gl.p_glVertex4f;
465             gl_info->gl_ops.gl.p_glVertex4f = wine_glVertex4f;
466         }
467         if(old_fogcoord_glVertex4fv) {
468             FIXME("GL_EXT_fogcoord glVertex4fv hook already applied\n");
469         } else {
470             old_fogcoord_glVertex4fv = gl_info->gl_ops.gl.p_glVertex4fv;
471             gl_info->gl_ops.gl.p_glVertex4fv = wine_glVertex4fv;
472         }
473         if(old_fogcoord_glVertex3f) {
474             FIXME("GL_EXT_fogcoord glVertex3f hook already applied\n");
475         } else {
476             old_fogcoord_glVertex3f = gl_info->gl_ops.gl.p_glVertex3f;
477             gl_info->gl_ops.gl.p_glVertex3f = wine_glVertex3f;
478         }
479         if(old_fogcoord_glVertex3fv) {
480             FIXME("GL_EXT_fogcoord glVertex3fv hook already applied\n");
481         } else {
482             old_fogcoord_glVertex3fv = gl_info->gl_ops.gl.p_glVertex3fv;
483             gl_info->gl_ops.gl.p_glVertex3fv = wine_glVertex3fv;
484         }
485
486         if(old_fogcoord_glColor4f) {
487             FIXME("GL_EXT_fogcoord glColor4f hook already applied\n");
488         } else {
489             old_fogcoord_glColor4f = gl_info->gl_ops.gl.p_glColor4f;
490             gl_info->gl_ops.gl.p_glColor4f = wine_glColor4f;
491         }
492         if(old_fogcoord_glColor4fv) {
493             FIXME("GL_EXT_fogcoord glColor4fv hook already applied\n");
494         } else {
495             old_fogcoord_glColor4fv = gl_info->gl_ops.gl.p_glColor4fv;
496             gl_info->gl_ops.gl.p_glColor4fv = wine_glColor4fv;
497         }
498         if(old_fogcoord_glColor3f) {
499             FIXME("GL_EXT_fogcoord glColor3f hook already applied\n");
500         } else {
501             old_fogcoord_glColor3f = gl_info->gl_ops.gl.p_glColor3f;
502             gl_info->gl_ops.gl.p_glColor3f = wine_glColor3f;
503         }
504         if(old_fogcoord_glColor3fv) {
505             FIXME("GL_EXT_fogcoord glColor3fv hook already applied\n");
506         } else {
507             old_fogcoord_glColor3fv = gl_info->gl_ops.gl.p_glColor3fv;
508             gl_info->gl_ops.gl.p_glColor3fv = wine_glColor3fv;
509         }
510         if(old_fogcoord_glColor4ub) {
511             FIXME("GL_EXT_fogcoord glColor4ub hook already applied\n");
512         } else {
513             old_fogcoord_glColor4ub = gl_info->gl_ops.gl.p_glColor4ub;
514             gl_info->gl_ops.gl.p_glColor4ub = wine_glColor4ub;
515         }
516
517         if(old_fogcoord_glFogCoordfEXT) {
518             FIXME("GL_EXT_fogcoord glFogCoordfEXT hook already applied\n");
519         } else {
520             old_fogcoord_glFogCoordfEXT = gl_info->gl_ops.ext.p_glFogCoordfEXT;
521             gl_info->gl_ops.ext.p_glFogCoordfEXT = wine_glFogCoordfEXT;
522         }
523         if(old_fogcoord_glFogCoordfvEXT) {
524             FIXME("GL_EXT_fogcoord glFogCoordfvEXT hook already applied\n");
525         } else {
526             old_fogcoord_glFogCoordfvEXT = gl_info->gl_ops.ext.p_glFogCoordfvEXT;
527             gl_info->gl_ops.ext.p_glFogCoordfvEXT = wine_glFogCoordfvEXT;
528         }
529         if(old_fogcoord_glFogCoorddEXT) {
530             FIXME("GL_EXT_fogcoord glFogCoorddEXT hook already applied\n");
531         } else {
532             old_fogcoord_glFogCoorddEXT = gl_info->gl_ops.ext.p_glFogCoorddEXT;
533             gl_info->gl_ops.ext.p_glFogCoorddEXT = wine_glFogCoorddEXT;
534         }
535         if(old_fogcoord_glFogCoorddvEXT) {
536             FIXME("GL_EXT_fogcoord glFogCoorddvEXT hook already applied\n");
537         } else {
538             old_fogcoord_glFogCoorddvEXT = gl_info->gl_ops.ext.p_glFogCoorddvEXT;
539             gl_info->gl_ops.ext.p_glFogCoorddvEXT = wine_glFogCoorddvEXT;
540         }
541         gl_info->supported[EXT_FOG_COORD] = TRUE;
542     }
543 }