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