1/*
2 * Copyright © Microsoft Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24#ifndef _GLDRV_
25#define _GLDRV_
26
27#include <specstrings.h>
28
29// Number of entries expected for various versions of OpenGL
30#define OPENGL_VERSION_100_ENTRIES      306
31#define OPENGL_VERSION_110_ENTRIES      336
32
33typedef struct _GLDISPATCHTABLE {
34    void      (APIENTRY *glNewList                )( GLuint list, GLenum mode );
35    void      (APIENTRY *glEndList                )( void );
36    void      (APIENTRY *glCallList               )( GLuint list );
37    void      (APIENTRY *glCallLists              )( GLsizei n, GLenum type, const GLvoid *lists );
38    void      (APIENTRY *glDeleteLists            )( GLuint list, GLsizei range );
39    GLuint    (APIENTRY *glGenLists               )( GLsizei range );
40    void      (APIENTRY *glListBase               )( GLuint base );
41    void      (APIENTRY *glBegin                  )( GLenum mode );
42    void      (APIENTRY *glBitmap                 )( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap );
43    void      (APIENTRY *glColor3b                )( GLbyte red, GLbyte green, GLbyte blue );
44    void      (APIENTRY *glColor3bv               )( const GLbyte *v );
45    void      (APIENTRY *glColor3d                )( GLdouble red, GLdouble green, GLdouble blue );
46    void      (APIENTRY *glColor3dv               )( const GLdouble *v );
47    void      (APIENTRY *glColor3f                )( GLfloat red, GLfloat green, GLfloat blue );
48    void      (APIENTRY *glColor3fv               )( const GLfloat *v );
49    void      (APIENTRY *glColor3i                )( GLint red, GLint green, GLint blue );
50    void      (APIENTRY *glColor3iv               )( const GLint *v );
51    void      (APIENTRY *glColor3s                )( GLshort red, GLshort green, GLshort blue );
52    void      (APIENTRY *glColor3sv               )( const GLshort *v );
53    void      (APIENTRY *glColor3ub               )( GLubyte red, GLubyte green, GLubyte blue );
54    void      (APIENTRY *glColor3ubv              )( const GLubyte *v );
55    void      (APIENTRY *glColor3ui               )( GLuint red, GLuint green, GLuint blue );
56    void      (APIENTRY *glColor3uiv              )( const GLuint *v );
57    void      (APIENTRY *glColor3us               )( GLushort red, GLushort green, GLushort blue );
58    void      (APIENTRY *glColor3usv              )( const GLushort *v );
59    void      (APIENTRY *glColor4b                )( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha );
60    void      (APIENTRY *glColor4bv               )( const GLbyte *v );
61    void      (APIENTRY *glColor4d                )( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha );
62    void      (APIENTRY *glColor4dv               )( const GLdouble *v );
63    void      (APIENTRY *glColor4f                )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
64    void      (APIENTRY *glColor4fv               )( const GLfloat *v );
65    void      (APIENTRY *glColor4i                )( GLint red, GLint green, GLint blue, GLint alpha );
66    void      (APIENTRY *glColor4iv               )( const GLint *v );
67    void      (APIENTRY *glColor4s                )( GLshort red, GLshort green, GLshort blue, GLshort alpha );
68    void      (APIENTRY *glColor4sv               )( const GLshort *v );
69    void      (APIENTRY *glColor4ub               )( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
70    void      (APIENTRY *glColor4ubv              )( const GLubyte *v );
71    void      (APIENTRY *glColor4ui               )( GLuint red, GLuint green, GLuint blue, GLuint alpha );
72    void      (APIENTRY *glColor4uiv              )( const GLuint *v );
73    void      (APIENTRY *glColor4us               )( GLushort red, GLushort green, GLushort blue, GLushort alpha );
74    void      (APIENTRY *glColor4usv              )( const GLushort *v );
75    void      (APIENTRY *glEdgeFlag               )( GLboolean flag );
76    void      (APIENTRY *glEdgeFlagv              )( const GLboolean *flag );
77    void      (APIENTRY *glEnd                    )( void );
78    void      (APIENTRY *glIndexd                 )( GLdouble c );
79    void      (APIENTRY *glIndexdv                )( const GLdouble *c );
80    void      (APIENTRY *glIndexf                 )( GLfloat c );
81    void      (APIENTRY *glIndexfv                )( const GLfloat *c );
82    void      (APIENTRY *glIndexi                 )( GLint c );
83    void      (APIENTRY *glIndexiv                )( const GLint *c );
84    void      (APIENTRY *glIndexs                 )( GLshort c );
85    void      (APIENTRY *glIndexsv                )( const GLshort *c );
86    void      (APIENTRY *glNormal3b               )( GLbyte nx, GLbyte ny, GLbyte nz );
87    void      (APIENTRY *glNormal3bv              )( const GLbyte *v );
88    void      (APIENTRY *glNormal3d               )( GLdouble nx, GLdouble ny, GLdouble nz );
89    void      (APIENTRY *glNormal3dv              )( const GLdouble *v );
90    void      (APIENTRY *glNormal3f               )( GLfloat nx, GLfloat ny, GLfloat nz );
91    void      (APIENTRY *glNormal3fv              )( const GLfloat *v );
92    void      (APIENTRY *glNormal3i               )( GLint nx, GLint ny, GLint nz );
93    void      (APIENTRY *glNormal3iv              )( const GLint *v );
94    void      (APIENTRY *glNormal3s               )( GLshort nx, GLshort ny, GLshort nz );
95    void      (APIENTRY *glNormal3sv              )( const GLshort *v );
96    void      (APIENTRY *glRasterPos2d            )( GLdouble x, GLdouble y );
97    void      (APIENTRY *glRasterPos2dv           )( const GLdouble *v );
98    void      (APIENTRY *glRasterPos2f            )( GLfloat x, GLfloat y );
99    void      (APIENTRY *glRasterPos2fv           )( const GLfloat *v );
100    void      (APIENTRY *glRasterPos2i            )( GLint x, GLint y );
101    void      (APIENTRY *glRasterPos2iv           )( const GLint *v );
102    void      (APIENTRY *glRasterPos2s            )( GLshort x, GLshort y );
103    void      (APIENTRY *glRasterPos2sv           )( const GLshort *v );
104    void      (APIENTRY *glRasterPos3d            )( GLdouble x, GLdouble y, GLdouble z );
105    void      (APIENTRY *glRasterPos3dv           )( const GLdouble *v );
106    void      (APIENTRY *glRasterPos3f            )( GLfloat x, GLfloat y, GLfloat z );
107    void      (APIENTRY *glRasterPos3fv           )( const GLfloat *v );
108    void      (APIENTRY *glRasterPos3i            )( GLint x, GLint y, GLint z );
109    void      (APIENTRY *glRasterPos3iv           )( const GLint *v );
110    void      (APIENTRY *glRasterPos3s            )( GLshort x, GLshort y, GLshort z );
111    void      (APIENTRY *glRasterPos3sv           )( const GLshort *v );
112    void      (APIENTRY *glRasterPos4d            )( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
113    void      (APIENTRY *glRasterPos4dv           )( const GLdouble *v );
114    void      (APIENTRY *glRasterPos4f            )( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
115    void      (APIENTRY *glRasterPos4fv           )( const GLfloat *v );
116    void      (APIENTRY *glRasterPos4i            )( GLint x, GLint y, GLint z, GLint w );
117    void      (APIENTRY *glRasterPos4iv           )( const GLint *v );
118    void      (APIENTRY *glRasterPos4s            )( GLshort x, GLshort y, GLshort z, GLshort w );
119    void      (APIENTRY *glRasterPos4sv           )( const GLshort *v );
120    void      (APIENTRY *glRectd                  )( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
121    void      (APIENTRY *glRectdv                 )( const GLdouble *v1, const GLdouble *v2 );
122    void      (APIENTRY *glRectf                  )( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
123    void      (APIENTRY *glRectfv                 )( const GLfloat *v1, const GLfloat *v2 );
124    void      (APIENTRY *glRecti                  )( GLint x1, GLint y1, GLint x2, GLint y2 );
125    void      (APIENTRY *glRectiv                 )( const GLint *v1, const GLint *v2 );
126    void      (APIENTRY *glRects                  )( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
127    void      (APIENTRY *glRectsv                 )( const GLshort *v1, const GLshort *v2 );
128    void      (APIENTRY *glTexCoord1d             )( GLdouble s );
129    void      (APIENTRY *glTexCoord1dv            )( const GLdouble *v );
130    void      (APIENTRY *glTexCoord1f             )( GLfloat s );
131    void      (APIENTRY *glTexCoord1fv            )( const GLfloat *v );
132    void      (APIENTRY *glTexCoord1i             )( GLint s );
133    void      (APIENTRY *glTexCoord1iv            )( const GLint *v );
134    void      (APIENTRY *glTexCoord1s             )( GLshort s );
135    void      (APIENTRY *glTexCoord1sv            )( const GLshort *v );
136    void      (APIENTRY *glTexCoord2d             )( GLdouble s, GLdouble t );
137    void      (APIENTRY *glTexCoord2dv            )( const GLdouble *v );
138    void      (APIENTRY *glTexCoord2f             )( GLfloat s, GLfloat t );
139    void      (APIENTRY *glTexCoord2fv            )( const GLfloat *v );
140    void      (APIENTRY *glTexCoord2i             )( GLint s, GLint t );
141    void      (APIENTRY *glTexCoord2iv            )( const GLint *v );
142    void      (APIENTRY *glTexCoord2s             )( GLshort s, GLshort t );
143    void      (APIENTRY *glTexCoord2sv            )( const GLshort *v );
144    void      (APIENTRY *glTexCoord3d             )( GLdouble s, GLdouble t, GLdouble r );
145    void      (APIENTRY *glTexCoord3dv            )( const GLdouble *v );
146    void      (APIENTRY *glTexCoord3f             )( GLfloat s, GLfloat t, GLfloat r );
147    void      (APIENTRY *glTexCoord3fv            )( const GLfloat *v );
148    void      (APIENTRY *glTexCoord3i             )( GLint s, GLint t, GLint r );
149    void      (APIENTRY *glTexCoord3iv            )( const GLint *v );
150    void      (APIENTRY *glTexCoord3s             )( GLshort s, GLshort t, GLshort r );
151    void      (APIENTRY *glTexCoord3sv            )( const GLshort *v );
152    void      (APIENTRY *glTexCoord4d             )( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
153    void      (APIENTRY *glTexCoord4dv            )( const GLdouble *v );
154    void      (APIENTRY *glTexCoord4f             )( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
155    void      (APIENTRY *glTexCoord4fv            )( const GLfloat *v );
156    void      (APIENTRY *glTexCoord4i             )( GLint s, GLint t, GLint r, GLint q );
157    void      (APIENTRY *glTexCoord4iv            )( const GLint *v );
158    void      (APIENTRY *glTexCoord4s             )( GLshort s, GLshort t, GLshort r, GLshort q );
159    void      (APIENTRY *glTexCoord4sv            )( const GLshort *v );
160    void      (APIENTRY *glVertex2d               )( GLdouble x, GLdouble y );
161    void      (APIENTRY *glVertex2dv              )( const GLdouble *v );
162    void      (APIENTRY *glVertex2f               )( GLfloat x, GLfloat y );
163    void      (APIENTRY *glVertex2fv              )( const GLfloat *v );
164    void      (APIENTRY *glVertex2i               )( GLint x, GLint y );
165    void      (APIENTRY *glVertex2iv              )( const GLint *v );
166    void      (APIENTRY *glVertex2s               )( GLshort x, GLshort y );
167    void      (APIENTRY *glVertex2sv              )( const GLshort *v );
168    void      (APIENTRY *glVertex3d               )( GLdouble x, GLdouble y, GLdouble z );
169    void      (APIENTRY *glVertex3dv              )( const GLdouble *v );
170    void      (APIENTRY *glVertex3f               )( GLfloat x, GLfloat y, GLfloat z );
171    void      (APIENTRY *glVertex3fv              )( const GLfloat *v );
172    void      (APIENTRY *glVertex3i               )( GLint x, GLint y, GLint z );
173    void      (APIENTRY *glVertex3iv              )( const GLint *v );
174    void      (APIENTRY *glVertex3s               )( GLshort x, GLshort y, GLshort z );
175    void      (APIENTRY *glVertex3sv              )( const GLshort *v );
176    void      (APIENTRY *glVertex4d               )( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
177    void      (APIENTRY *glVertex4dv              )( const GLdouble *v );
178    void      (APIENTRY *glVertex4f               )( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
179    void      (APIENTRY *glVertex4fv              )( const GLfloat *v );
180    void      (APIENTRY *glVertex4i               )( GLint x, GLint y, GLint z, GLint w );
181    void      (APIENTRY *glVertex4iv              )( const GLint *v );
182    void      (APIENTRY *glVertex4s               )( GLshort x, GLshort y, GLshort z, GLshort w );
183    void      (APIENTRY *glVertex4sv              )( const GLshort *v );
184    void      (APIENTRY *glClipPlane              )( GLenum plane, const GLdouble *equation );
185    void      (APIENTRY *glColorMaterial          )( GLenum face, GLenum mode );
186    void      (APIENTRY *glCullFace               )( GLenum mode );
187    void      (APIENTRY *glFogf                   )( GLenum pname, GLfloat param );
188    void      (APIENTRY *glFogfv                  )( GLenum pname, const GLfloat *params );
189    void      (APIENTRY *glFogi                   )( GLenum pname, GLint param );
190    void      (APIENTRY *glFogiv                  )( GLenum pname, const GLint *params );
191    void      (APIENTRY *glFrontFace              )( GLenum mode );
192    void      (APIENTRY *glHint                   )( GLenum target, GLenum mode );
193    void      (APIENTRY *glLightf                 )( GLenum light, GLenum pname, GLfloat param );
194    void      (APIENTRY *glLightfv                )( GLenum light, GLenum pname, const GLfloat *params );
195    void      (APIENTRY *glLighti                 )( GLenum light, GLenum pname, GLint param );
196    void      (APIENTRY *glLightiv                )( GLenum light, GLenum pname, const GLint *params );
197    void      (APIENTRY *glLightModelf            )( GLenum pname, GLfloat param );
198    void      (APIENTRY *glLightModelfv           )( GLenum pname, const GLfloat *params );
199    void      (APIENTRY *glLightModeli            )( GLenum pname, GLint param );
200    void      (APIENTRY *glLightModeliv           )( GLenum pname, const GLint *params );
201    void      (APIENTRY *glLineStipple            )( GLint factor, GLushort pattern );
202    void      (APIENTRY *glLineWidth              )( GLfloat width );
203    void      (APIENTRY *glMaterialf              )( GLenum face, GLenum pname, GLfloat param );
204    void      (APIENTRY *glMaterialfv             )( GLenum face, GLenum pname, const GLfloat *params );
205    void      (APIENTRY *glMateriali              )( GLenum face, GLenum pname, GLint param );
206    void      (APIENTRY *glMaterialiv             )( GLenum face, GLenum pname, const GLint *params );
207    void      (APIENTRY *glPointSize              )( GLfloat size );
208    void      (APIENTRY *glPolygonMode            )( GLenum face, GLenum mode );
209    void      (APIENTRY *glPolygonStipple         )( const GLubyte *mask );
210    void      (APIENTRY *glScissor                )( GLint x, GLint y, GLsizei width, GLsizei height );
211    void      (APIENTRY *glShadeModel             )( GLenum mode );
212    void      (APIENTRY *glTexParameterf          )( GLenum target, GLenum pname, GLfloat param );
213    void      (APIENTRY *glTexParameterfv         )( GLenum target, GLenum pname, const GLfloat *params );
214    void      (APIENTRY *glTexParameteri          )( GLenum target, GLenum pname, GLint param );
215    void      (APIENTRY *glTexParameteriv         )( GLenum target, GLenum pname, const GLint *params );
216    void      (APIENTRY *glTexImage1D             )( GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
217    void      (APIENTRY *glTexImage2D             )( GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
218    void      (APIENTRY *glTexEnvf                )( GLenum target, GLenum pname, GLfloat param );
219    void      (APIENTRY *glTexEnvfv               )( GLenum target, GLenum pname, const GLfloat *params );
220    void      (APIENTRY *glTexEnvi                )( GLenum target, GLenum pname, GLint param );
221    void      (APIENTRY *glTexEnviv               )( GLenum target, GLenum pname, const GLint *params );
222    void      (APIENTRY *glTexGend                )( GLenum coord, GLenum pname, GLdouble param );
223    void      (APIENTRY *glTexGendv               )( GLenum coord, GLenum pname, const GLdouble *params );
224    void      (APIENTRY *glTexGenf                )( GLenum coord, GLenum pname, GLfloat param );
225    void      (APIENTRY *glTexGenfv               )( GLenum coord, GLenum pname, const GLfloat *params );
226    void      (APIENTRY *glTexGeni                )( GLenum coord, GLenum pname, GLint param );
227    void      (APIENTRY *glTexGeniv               )( GLenum coord, GLenum pname, const GLint *params );
228    void      (APIENTRY *glFeedbackBuffer         )( GLsizei size, GLenum type, GLfloat *buffer );
229    void      (APIENTRY *glSelectBuffer           )( GLsizei size, GLuint *buffer );
230    GLint     (APIENTRY *glRenderMode             )( GLenum mode );
231    void      (APIENTRY *glInitNames              )( void );
232    void      (APIENTRY *glLoadName               )( GLuint name );
233    void      (APIENTRY *glPassThrough            )( GLfloat token );
234    void      (APIENTRY *glPopName                )( void );
235    void      (APIENTRY *glPushName               )( GLuint name );
236    void      (APIENTRY *glDrawBuffer             )( GLenum mode );
237    void      (APIENTRY *glClear                  )( GLbitfield mask );
238    void      (APIENTRY *glClearAccum             )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
239    void      (APIENTRY *glClearIndex             )( GLfloat c );
240    void      (APIENTRY *glClearColor             )( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
241    void      (APIENTRY *glClearStencil           )( GLint s );
242    void      (APIENTRY *glClearDepth             )( GLclampd depth );
243    void      (APIENTRY *glStencilMask            )( GLuint mask );
244    void      (APIENTRY *glColorMask              )( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
245    void      (APIENTRY *glDepthMask              )( GLboolean flag );
246    void      (APIENTRY *glIndexMask              )( GLuint mask );
247    void      (APIENTRY *glAccum                  )( GLenum op, GLfloat value );
248    void      (APIENTRY *glDisable                )( GLenum cap );
249    void      (APIENTRY *glEnable                 )( GLenum cap );
250    void      (APIENTRY *glFinish                 )( void );
251    void      (APIENTRY *glFlush                  )( void );
252    void      (APIENTRY *glPopAttrib              )( void );
253    void      (APIENTRY *glPushAttrib             )( GLbitfield mask );
254    void      (APIENTRY *glMap1d                  )( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points );
255    void      (APIENTRY *glMap1f                  )( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points );
256    void      (APIENTRY *glMap2d                  )( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points );
257    void      (APIENTRY *glMap2f                  )( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points );
258    void      (APIENTRY *glMapGrid1d              )( GLint un, GLdouble u1, GLdouble u2 );
259    void      (APIENTRY *glMapGrid1f              )( GLint un, GLfloat u1, GLfloat u2 );
260    void      (APIENTRY *glMapGrid2d              )( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 );
261    void      (APIENTRY *glMapGrid2f              )( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 );
262    void      (APIENTRY *glEvalCoord1d            )( GLdouble u );
263    void      (APIENTRY *glEvalCoord1dv           )( const GLdouble *u );
264    void      (APIENTRY *glEvalCoord1f            )( GLfloat u );
265    void      (APIENTRY *glEvalCoord1fv           )( const GLfloat *u );
266    void      (APIENTRY *glEvalCoord2d            )( GLdouble u, GLdouble v );
267    void      (APIENTRY *glEvalCoord2dv           )( const GLdouble *u );
268    void      (APIENTRY *glEvalCoord2f            )( GLfloat u, GLfloat v );
269    void      (APIENTRY *glEvalCoord2fv           )( const GLfloat *u );
270    void      (APIENTRY *glEvalMesh1              )( GLenum mode, GLint i1, GLint i2 );
271    void      (APIENTRY *glEvalPoint1             )( GLint i );
272    void      (APIENTRY *glEvalMesh2              )( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
273    void      (APIENTRY *glEvalPoint2             )( GLint i, GLint j );
274    void      (APIENTRY *glAlphaFunc              )( GLenum func, GLclampf ref );
275    void      (APIENTRY *glBlendFunc              )( GLenum sfactor, GLenum dfactor );
276    void      (APIENTRY *glLogicOp                )( GLenum opcode );
277    void      (APIENTRY *glStencilFunc            )( GLenum func, GLint ref, GLuint mask );
278    void      (APIENTRY *glStencilOp              )( GLenum fail, GLenum zfail, GLenum zpass );
279    void      (APIENTRY *glDepthFunc              )( GLenum func );
280    void      (APIENTRY *glPixelZoom              )( GLfloat xfactor, GLfloat yfactor );
281    void      (APIENTRY *glPixelTransferf         )( GLenum pname, GLfloat param );
282    void      (APIENTRY *glPixelTransferi         )( GLenum pname, GLint param );
283    void      (APIENTRY *glPixelStoref            )( GLenum pname, GLfloat param );
284    void      (APIENTRY *glPixelStorei            )( GLenum pname, GLint param );
285    void      (APIENTRY *glPixelMapfv             )( GLenum map, GLint mapsize, const GLfloat *values );
286    void      (APIENTRY *glPixelMapuiv            )( GLenum map, GLint mapsize, const GLuint *values );
287    void      (APIENTRY *glPixelMapusv            )( GLenum map, GLint mapsize, const GLushort *values );
288    void      (APIENTRY *glReadBuffer             )( GLenum mode );
289    void      (APIENTRY *glCopyPixels             )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type );
290    void      (APIENTRY *glReadPixels             )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels );
291    void      (APIENTRY *glDrawPixels             )( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
292    void      (APIENTRY *glGetBooleanv            )( GLenum pname, GLboolean *params );
293    void      (APIENTRY *glGetClipPlane           )( GLenum plane, GLdouble *equation );
294    void      (APIENTRY *glGetDoublev             )( GLenum pname, GLdouble *params );
295    GLenum    (APIENTRY *glGetError               )( void );
296    void      (APIENTRY *glGetFloatv              )( GLenum pname, GLfloat *params );
297    void      (APIENTRY *glGetIntegerv            )( GLenum pname, GLint *params );
298    void      (APIENTRY *glGetLightfv             )( GLenum light, GLenum pname, GLfloat *params );
299    void      (APIENTRY *glGetLightiv             )( GLenum light, GLenum pname, GLint *params );
300    void      (APIENTRY *glGetMapdv               )( GLenum target, GLenum query, GLdouble *v );
301    void      (APIENTRY *glGetMapfv               )( GLenum target, GLenum query, GLfloat *v );
302    void      (APIENTRY *glGetMapiv               )( GLenum target, GLenum query, GLint *v );
303    void      (APIENTRY *glGetMaterialfv          )( GLenum face, GLenum pname, GLfloat *params );
304    void      (APIENTRY *glGetMaterialiv          )( GLenum face, GLenum pname, GLint *params );
305    void      (APIENTRY *glGetPixelMapfv          )( GLenum map, GLfloat *values );
306    void      (APIENTRY *glGetPixelMapuiv         )( GLenum map, GLuint *values );
307    void      (APIENTRY *glGetPixelMapusv         )( GLenum map, GLushort *values );
308    void      (APIENTRY *glGetPolygonStipple      )( GLubyte *mask );
309    const GLubyte * (APIENTRY *glGetString        )( GLenum name );
310    void      (APIENTRY *glGetTexEnvfv            )( GLenum target, GLenum pname, GLfloat *params );
311    void      (APIENTRY *glGetTexEnviv            )( GLenum target, GLenum pname, GLint *params );
312    void      (APIENTRY *glGetTexGendv            )( GLenum coord, GLenum pname, GLdouble *params );
313    void      (APIENTRY *glGetTexGenfv            )( GLenum coord, GLenum pname, GLfloat *params );
314    void      (APIENTRY *glGetTexGeniv            )( GLenum coord, GLenum pname, GLint *params );
315    void      (APIENTRY *glGetTexImage            )( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels );
316    void      (APIENTRY *glGetTexParameterfv      )( GLenum target, GLenum pname, GLfloat *params );
317    void      (APIENTRY *glGetTexParameteriv      )( GLenum target, GLenum pname, GLint *params );
318    void      (APIENTRY *glGetTexLevelParameterfv )( GLenum target, GLint level, GLenum pname, GLfloat *params );
319    void      (APIENTRY *glGetTexLevelParameteriv )( GLenum target, GLint level, GLenum pname, GLint *params );
320    GLboolean (APIENTRY *glIsEnabled              )( GLenum cap );
321    GLboolean (APIENTRY *glIsList                 )( GLuint list );
322    void      (APIENTRY *glDepthRange             )( GLclampd zNear, GLclampd zFar );
323    void      (APIENTRY *glFrustum                )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
324    void      (APIENTRY *glLoadIdentity           )( void );
325    void      (APIENTRY *glLoadMatrixf            )( const GLfloat *m );
326    void      (APIENTRY *glLoadMatrixd            )( const GLdouble *m );
327    void      (APIENTRY *glMatrixMode             )( GLenum mode );
328    void      (APIENTRY *glMultMatrixf            )( const GLfloat *m );
329    void      (APIENTRY *glMultMatrixd            )( const GLdouble *m );
330    void      (APIENTRY *glOrtho                  )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
331    void      (APIENTRY *glPopMatrix              )( void );
332    void      (APIENTRY *glPushMatrix             )( void );
333    void      (APIENTRY *glRotated                )( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
334    void      (APIENTRY *glRotatef                )( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
335    void      (APIENTRY *glScaled                 )( GLdouble x, GLdouble y, GLdouble z );
336    void      (APIENTRY *glScalef                 )( GLfloat x, GLfloat y, GLfloat z );
337    void      (APIENTRY *glTranslated             )( GLdouble x, GLdouble y, GLdouble z );
338    void      (APIENTRY *glTranslatef             )( GLfloat x, GLfloat y, GLfloat z );
339    void      (APIENTRY *glViewport               )( GLint x, GLint y, GLsizei width, GLsizei height );
340    // OpenGL version 1.0 entries end here
341
342    // OpenGL version 1.1 entries begin here
343    void      (APIENTRY *glArrayElement           )(GLint i);
344    void      (APIENTRY *glBindTexture            )(GLenum target, GLuint texture);
345    void      (APIENTRY *glColorPointer           )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
346    void      (APIENTRY *glDisableClientState     )(GLenum array);
347    void      (APIENTRY *glDrawArrays             )(GLenum mode, GLint first, GLsizei count);
348    void      (APIENTRY *glDrawElements           )(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
349    void      (APIENTRY *glEdgeFlagPointer        )(GLsizei stride, const GLvoid *pointer);
350    void      (APIENTRY *glEnableClientState      )(GLenum array);
351    void      (APIENTRY *glIndexPointer           )(GLenum type, GLsizei stride, const GLvoid *pointer);
352    void      (APIENTRY *glIndexub                )(GLubyte c);
353    void      (APIENTRY *glIndexubv               )(const GLubyte *c);
354    void      (APIENTRY *glInterleavedArrays      )(GLenum format, GLsizei stride, const GLvoid *pointer);
355    void      (APIENTRY *glNormalPointer          )(GLenum type, GLsizei stride, const GLvoid *pointer);
356    void      (APIENTRY *glPolygonOffset          )(GLfloat factor, GLfloat units);
357    void      (APIENTRY *glTexCoordPointer        )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
358    void      (APIENTRY *glVertexPointer          )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
359    GLboolean (APIENTRY *glAreTexturesResident    )(GLsizei n, const GLuint *textures, GLboolean *residences);
360    void      (APIENTRY *glCopyTexImage1D         )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
361    void      (APIENTRY *glCopyTexImage2D         )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
362    void      (APIENTRY *glCopyTexSubImage1D      )(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
363    void      (APIENTRY *glCopyTexSubImage2D      )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
364    void      (APIENTRY *glDeleteTextures         )(GLsizei n, const GLuint *textures);
365    void      (APIENTRY *glGenTextures            )(GLsizei n, GLuint *textures);
366    void      (APIENTRY *glGetPointerv            )(GLenum pname, GLvoid* *params);
367    GLboolean (APIENTRY *glIsTexture              )(GLuint texture);
368    void      (APIENTRY *glPrioritizeTextures     )(GLsizei n, const GLuint *textures, const GLclampf *priorities);
369    void      (APIENTRY *glTexSubImage1D          )(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
370    void      (APIENTRY *glTexSubImage2D          )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
371    void      (APIENTRY *glPopClientAttrib        )(void);
372    void      (APIENTRY *glPushClientAttrib       )(GLbitfield mask);
373} GLDISPATCHTABLE, *PGLDISPATCHTABLE;
374
375// OpenGL Client/Driver Procedure Table.
376
377typedef struct _GLCLTPROCTABLE {
378    _In_range_(0,OPENGL_VERSION_110_ENTRIES) int             cEntries;           // Number of function entries in table
379    GLDISPATCHTABLE glDispatchTable;    // OpenGL function dispatch table
380} GLCLTPROCTABLE, *PGLCLTPROCTABLE;
381
382// Driver GLRC handle.
383
384typedef ULONG DHGLRC;
385
386// SetProcTable function prototype for DrvSetContext.
387
388typedef VOID (APIENTRY *PFN_SETPROCTABLE)(PGLCLTPROCTABLE);
389
390// DrvSetCallbackProcs prototypes
391typedef VOID   (APIENTRY *PFN_SETCURRENTVALUE)(VOID *pv);
392typedef VOID  *(APIENTRY *PFN_GETCURRENTVALUE)(VOID);
393typedef DHGLRC (APIENTRY *PFN_GETDHGLRC)(HGLRC hrc);
394#if WINVER >= 0x600
395typedef struct _PRESENTBUFFERSCB {
396    IN UINT nVersion;
397    IN UINT syncType;      // See PRESCB_SYNCTYPE_NONE and PRESCB_SYNCTYPE_VSYNC
398    IN LUID luidAdapter;
399    IN LPVOID pPrivData;
400    IN RECT updateRect;    // Update rectangle in the coordinate system of the window, whose HDC is passed to PFN_PRESENTBUFFERS
401} PRESENTBUFFERSCB, *LPPRESENTBUFFERSCB;
402typedef BOOL (APIENTRY *PFN_PRESENTBUFFERS)(HDC hdc, LPPRESENTBUFFERSCB pprsbcbData);
403#endif
404#if WINVER >= 0xA00
405typedef VOID   (APIENTRY *PFN_GETADAPTERLUID)(HDC hdc, OUT LUID* pLuid);
406typedef struct _CHECKFULLSCREENSUPPORTCB {
407    IN UINT nVersion;
408    IN LUID luidAdapter;
409    IN UINT hDevice;
410    IN HMONITOR hMonitor;
411    OUT UINT VidPnSourceId;
412} CHECKFULLSCREENSUPPORTCB, *LPCHECKFULLSCREENSUPPORTCB;
413typedef BOOL   (APIENTRY *PFN_CHECKFULLSCREENSUPPORT)(HDC hdc, LPCHECKFULLSCREENSUPPORTCB pArgs);
414typedef struct _PRESENTTOREDIRECTIONSURFACECB {
415    IN UINT nVersion;
416    IN UINT hContext;
417    IN UINT hSource;
418    IN UINT hDestination;
419    IN HANDLE hSharedHandle;
420    IN UINT64 updateId;
421    IN RECT updateRect;
422    IN UINT broadcastContextCount;
423    IN UINT broadcastContext[64];
424    IN UINT broadcastSrcAllocation[64];
425    IN UINT broadcastDstAllocation[64];
426    IN UINT cbPrivateDriverDataSize;
427    IN VOID *pPrivateDriverData;
428} PRESENTTOREDIRECTIONSURFACECB, *LPPRESENTTOREDIRECTIONSURFACECB;
429typedef BOOL   (APIENTRY *PFN_PRESENTTOREDIRECTIONSURFACE)(HDC hdc, LPPRESENTTOREDIRECTIONSURFACECB pArgs);
430typedef struct _SUBMITPRESENTTOREDIRECTIONSURFACECB {
431    IN UINT nVersion;
432    IN HANDLE hSharedHandle;
433    IN UINT64 updateId;
434    IN RECT updateRect;
435    IN UINT broadcastHwQueueCount;
436
437    _Field_size_(broadcastHwQueueCount)
438    IN UINT *broadcastHwQueue;
439
440    _Field_size_(broadcastHwQueueCount)
441    IN UINT *broadcastSrcAllocation;
442
443    _Field_size_opt_(broadcastHwQueueCount)
444    IN UINT *broadcastDstAllocation;
445
446    IN UINT cbPrivateDriverDataSize;
447    IN VOID *pPrivateDriverData;
448} SUBMITPRESENTTOREDIRECTIONSURFACECB, *LPSUBMITPRESENTTOREDIRECTIONSURFACECB;
449typedef BOOL   (APIENTRY *PFN_SUBMITPRESENTTOREDIRECTIONSURFACE)(HDC hdc, LPSUBMITPRESENTTOREDIRECTIONSURFACECB pArgs);
450#endif
451
452// Note: Structure not referenced directly, simply present to document the expected order/count of
453// callbacks received through DrvSetCallbackProcs.
454struct WGLCALLBACKS
455{
456    PFN_SETCURRENTVALUE pfnSetCurrentValue;
457    PFN_GETCURRENTVALUE pfnGetCurrentValue;
458    PFN_GETDHGLRC pfnGetDhglrc;
459    PROC pfnUnused;
460#if WINVER >= 0x600
461    PFN_PRESENTBUFFERS pfnPresentBuffers;
462#endif
463#if WINVER >= 0xA00
464    PFN_GETADAPTERLUID pfnGetAdapterLuid;
465    PFN_CHECKFULLSCREENSUPPORT pfnCheckFullscreenSupport;
466    PFN_PRESENTTOREDIRECTIONSURFACE pfnPresentToRedirectionSurface;
467    PFN_SUBMITPRESENTTOREDIRECTIONSURFACE pfnSubmitPresentToRedirectionSurface;
468#endif
469};
470
471// Driver context function prototypes.
472
473BOOL            APIENTRY DrvCopyContext(DHGLRC, DHGLRC, UINT);
474DHGLRC          APIENTRY DrvCreateContext(HDC);
475DHGLRC          APIENTRY DrvCreateLayerContext(HDC, int);
476BOOL            APIENTRY DrvDeleteContext(DHGLRC);
477PGLCLTPROCTABLE APIENTRY DrvSetContext(HDC,DHGLRC,PFN_SETPROCTABLE);
478BOOL            APIENTRY DrvReleaseContext(DHGLRC);
479BOOL            APIENTRY DrvValidateVersion(ULONG);
480BOOL		APIENTRY DrvShareLists(DHGLRC, DHGLRC);
481PROC            APIENTRY DrvGetProcAddress(LPCSTR);
482VOID            APIENTRY DrvSetCallbackProcs(INT, PROC *); // See WGLCALLBACKS for expected order/count per OS.
483BOOL            APIENTRY DrvDescribeLayerPlane(HDC, INT, INT, UINT,
484                                               LPLAYERPLANEDESCRIPTOR);
485INT             APIENTRY DrvSetLayerPaletteEntries(HDC, INT, INT, INT,
486                                                   CONST COLORREF *);
487INT             APIENTRY DrvGetLayerPaletteEntries(HDC, INT, INT, INT,
488                                                   COLORREF *);
489BOOL            APIENTRY DrvRealizeLayerPalette(HDC, INT, BOOL);
490BOOL            APIENTRY DrvSwapLayerBuffers(HDC, UINT);
491
492#if WINVER >= 0x500
493
494typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE;
495typedef struct _DDSURFACEDESC *LPDDSURFACEDESC;
496
497DHGLRC          APIENTRY DrvCreateDirectDrawContext(HDC, LPDIRECTDRAWSURFACE,
498                                                    int);
499int             APIENTRY DrvEnumTextureFormats(int, LPDDSURFACEDESC);
500BOOL            APIENTRY DrvBindDirectDrawTexture(LPDIRECTDRAWSURFACE);
501DWORD           APIENTRY DrvSwapMultipleBuffers(UINT cBuffers,
502                                                CONST WGLSWAP *pgswap);
503
504LONG            APIENTRY DrvDescribePixelFormat(HDC, INT, ULONG, PIXELFORMATDESCRIPTOR*);
505BOOL            APIENTRY DrvSetPixelFormat(HDC, LONG);
506BOOL            APIENTRY DrvSwapBuffers(HDC);
507
508#endif // WINVER >= 0x500
509
510#if WINVER >= 0x600
511typedef struct _PRESENTBUFFERS {
512    IN HANDLE hSurface;
513    IN LUID luidAdapter;
514    IN ULONGLONG ullPresentToken;
515    IN LPVOID pPrivData;
516} PRESENTBUFFERS, *LPPRESENTBUFFERS;
517typedef BOOL (APIENTRY *PFN_PRESENTBUFFERS)(HDC hdc, LPPRESENTBUFFERSCB pprsbcbData);
518
519#define PRESCB_SYNCTYPE_NONE 0
520#define PRESCB_SYNCTYPE_VSYNC  1
521
522BOOL            APIENTRY DrvPresentBuffers(HDC hdc, LPPRESENTBUFFERS pprsbData);
523
524#endif
525
526// Input structure for OPENGL_CMD ExtEscape.
527
528typedef struct _WNDOBJ WNDOBJ;
529typedef struct _XLATEOBJ XLATEOBJ;
530
531typedef struct _OPENGLCMD
532{
533    ULONG    ulSubEsc;
534    FLONG    fl;
535    WNDOBJ   *pwo;
536    XLATEOBJ *pxo;
537} OPENGLCMD, *POPENGLCMD;
538
539#if WINVER >= 0x500
540
541#define OPENGLCMD_MAXMULTI WGL_SWAPMULTIPLE_MAX
542
543typedef struct _OPENGLCMDMULTI
544{
545    ULONG ulSubEsc;
546    FLONG fl;
547    ULONG cMulti;
548    XLATEOBJ *pxo;
549} OPENGLCMDMULTI, *POPENGLCMDMULTI;
550
551#endif // WINVER >= 0x500
552
553// Flags for OPENGL_CMD ExtEscape.
554
555#define OGLCMD_NEEDWNDOBJ       0x01
556#define OGLCMD_NEEDXLATEOBJ     0x02
557
558#if WINVER >= 0x500
559#define OGLCMD_MULTIWNDOBJ      0x04
560#endif // WINVER >= 0x500
561
562// OPENGL_GETINFO ExtEscape sub-escape numbers.  They are defined by Microsoft.
563
564#define OPENGL_GETINFO_DRVNAME  0
565
566// Input structure for OPENGL_GETINFO ExtEscape.
567
568typedef struct _OPENGLGETINFO
569{
570    ULONG   ulSubEsc;
571} OPENGLGETINFO, *POPENGLGETINFO;
572
573// Input structure for OPENGL_GETINFO_DRVNAME ExtEscape.
574
575typedef struct _GLDRVNAME
576{
577    OPENGLGETINFO   oglget;
578} GLDRVNAME, *PGLDRVNAME;
579
580// Output structure for OPENGL_GETINFO_DRVNAME ExtEscape.
581
582typedef struct _GLDRVNAMERET
583{
584    ULONG   ulVersion;              // must be 1 for this version
585    ULONG   ulDriverVersion;        // driver specific version number
586    WCHAR   awch[MAX_PATH+1];
587} GLDRVNAMERET, *PGLDRVNAMERET;
588
589#endif /* _GLDRV_ */
590