63877235408d1549c47178cf76b581528cafd32f
[mesa.git] / src / gallium / state_trackers / wgl / stw_context.c
1 /**************************************************************************
2 *
3 * Copyright 2008 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #include <windows.h>
29
30 #define WGL_WGLEXT_PROTOTYPES
31
32 #include <GL/gl.h>
33 #include <GL/wglext.h>
34
35 #include "pipe/p_compiler.h"
36 #include "pipe/p_context.h"
37 #include "pipe/p_state.h"
38 #include "util/u_memory.h"
39 #include "util/u_atomic.h"
40 #include "state_tracker/st_api.h"
41 #include "hud/hud_context.h"
42
43 #include "stw_icd.h"
44 #include "stw_device.h"
45 #include "stw_winsys.h"
46 #include "stw_framebuffer.h"
47 #include "stw_pixelformat.h"
48 #include "stw_context.h"
49 #include "stw_tls.h"
50
51
52 struct stw_context *
53 stw_current_context(void)
54 {
55 struct st_context_iface *st;
56
57 st = (stw_dev) ? stw_dev->stapi->get_current(stw_dev->stapi) : NULL;
58
59 return (struct stw_context *) ((st) ? st->st_manager_private : NULL);
60 }
61
62
63 BOOL APIENTRY
64 DrvCopyContext(DHGLRC dhrcSource, DHGLRC dhrcDest, UINT fuMask)
65 {
66 struct stw_context *src;
67 struct stw_context *dst;
68 BOOL ret = FALSE;
69
70 if (!stw_dev)
71 return FALSE;
72
73 stw_lock_contexts(stw_dev);
74
75 src = stw_lookup_context_locked( dhrcSource );
76 dst = stw_lookup_context_locked( dhrcDest );
77
78 if (src && dst) {
79 /* FIXME */
80 assert(0);
81 (void) src;
82 (void) dst;
83 (void) fuMask;
84 }
85
86 stw_unlock_contexts(stw_dev);
87
88 return ret;
89 }
90
91
92 BOOL APIENTRY
93 DrvShareLists(DHGLRC dhglrc1, DHGLRC dhglrc2)
94 {
95 struct stw_context *ctx1;
96 struct stw_context *ctx2;
97 BOOL ret = FALSE;
98
99 if (!stw_dev)
100 return FALSE;
101
102 stw_lock_contexts(stw_dev);
103
104 ctx1 = stw_lookup_context_locked( dhglrc1 );
105 ctx2 = stw_lookup_context_locked( dhglrc2 );
106
107 if (ctx1 && ctx2 && ctx2->st->share)
108 ret = ctx2->st->share(ctx2->st, ctx1->st);
109
110 stw_unlock_contexts(stw_dev);
111
112 return ret;
113 }
114
115
116 DHGLRC APIENTRY
117 DrvCreateContext(HDC hdc)
118 {
119 return DrvCreateLayerContext( hdc, 0 );
120 }
121
122
123 DHGLRC APIENTRY
124 DrvCreateLayerContext(HDC hdc, INT iLayerPlane)
125 {
126 return stw_create_context_attribs(hdc, iLayerPlane, 0, 1, 0, 0,
127 WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
128 0);
129 }
130
131
132 /**
133 * Called via DrvCreateContext(), DrvCreateLayerContext() and
134 * wglCreateContextAttribsARB() to actually create a rendering context.
135 * \param handle the desired DHGLRC handle to use for the context, or zero
136 * if a new handle should be allocated.
137 * \return the handle for the new context or zero if there was a problem.
138 */
139 DHGLRC
140 stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
141 int majorVersion, int minorVersion,
142 int contextFlags, int profileMask,
143 DHGLRC handle)
144 {
145 int iPixelFormat;
146 struct stw_framebuffer *fb;
147 const struct stw_pixelformat_info *pfi;
148 struct st_context_attribs attribs;
149 struct stw_context *ctx = NULL;
150 struct stw_context *shareCtx = NULL;
151 enum st_context_error ctx_err = 0;
152
153 if (!stw_dev)
154 return 0;
155
156 if (iLayerPlane != 0)
157 return 0;
158
159 /*
160 * GDI only knows about displayable pixel formats, so determine the pixel
161 * format from the framebuffer.
162 *
163 * This also allows to use a OpenGL DLL / ICD without installing.
164 */
165 fb = stw_framebuffer_from_hdc( hdc );
166 if (fb) {
167 iPixelFormat = fb->iPixelFormat;
168 stw_framebuffer_unlock(fb);
169 } else {
170 return 0;
171 }
172
173 pfi = stw_pixelformat_get_info( iPixelFormat );
174
175 if (hShareContext != 0) {
176 stw_lock_contexts(stw_dev);
177 shareCtx = stw_lookup_context_locked( hShareContext );
178 stw_unlock_contexts(stw_dev);
179 }
180
181 ctx = CALLOC_STRUCT( stw_context );
182 if (ctx == NULL)
183 goto no_ctx;
184
185 ctx->hdc = hdc;
186 ctx->iPixelFormat = iPixelFormat;
187
188 memset(&attribs, 0, sizeof(attribs));
189 attribs.visual = pfi->stvis;
190 attribs.major = majorVersion;
191 attribs.minor = minorVersion;
192 if (contextFlags & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
193 attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE;
194 if (contextFlags & WGL_CONTEXT_DEBUG_BIT_ARB)
195 attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
196
197 switch (profileMask) {
198 case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:
199 /* There are no profiles before OpenGL 3.2. The
200 * WGL_ARB_create_context_profile spec says:
201 *
202 * "If the requested OpenGL version is less than 3.2,
203 * WGL_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality
204 * of the context is determined solely by the requested version."
205 */
206 if (majorVersion > 3 || (majorVersion == 3 && minorVersion >= 2)) {
207 attribs.profile = ST_PROFILE_OPENGL_CORE;
208 break;
209 }
210 /* fall-through */
211 case WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
212 /*
213 * The spec also says:
214 *
215 * "If version 3.1 is requested, the context returned may implement
216 * any of the following versions:
217 *
218 * * Version 3.1. The GL_ARB_compatibility extension may or may not
219 * be implemented, as determined by the implementation.
220 * * The core profile of version 3.2 or greater."
221 *
222 * But Mesa doesn't support GL_ARB_compatibility, while most prevalent
223 * Windows OpenGL implementations do, and unfortunately many Windows
224 * applications don't check whether they receive or not a context with
225 * GL_ARB_compatibility, so returning a core profile here does more harm
226 * than good.
227 */
228 attribs.profile = ST_PROFILE_DEFAULT;
229 break;
230 case WGL_CONTEXT_ES_PROFILE_BIT_EXT:
231 if (majorVersion >= 2) {
232 attribs.profile = ST_PROFILE_OPENGL_ES2;
233 } else {
234 attribs.profile = ST_PROFILE_OPENGL_ES1;
235 }
236 break;
237 default:
238 assert(0);
239 goto no_st_ctx;
240 }
241
242 ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
243 stw_dev->smapi, &attribs, &ctx_err, shareCtx ? shareCtx->st : NULL);
244 if (ctx->st == NULL)
245 goto no_st_ctx;
246
247 ctx->st->st_manager_private = (void *) ctx;
248
249 if (ctx->st->cso_context) {
250 ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context);
251 }
252
253 stw_lock_contexts(stw_dev);
254 if (handle) {
255 /* We're replacing the context data for this handle. See the
256 * wglCreateContextAttribsARB() function.
257 */
258 struct stw_context *old_ctx =
259 stw_lookup_context_locked((unsigned) handle);
260 if (old_ctx) {
261 /* free the old context data associated with this handle */
262 if (old_ctx->hud) {
263 hud_destroy(old_ctx->hud);
264 }
265 ctx->st->destroy(old_ctx->st);
266 FREE(old_ctx);
267 }
268
269 /* replace table entry */
270 handle_table_set(stw_dev->ctx_table, (unsigned) handle, ctx);
271 }
272 else {
273 /* create new table entry */
274 handle = (DHGLRC) handle_table_add(stw_dev->ctx_table, ctx);
275 }
276
277 ctx->dhglrc = handle;
278
279 stw_unlock_contexts(stw_dev);
280
281 if (!ctx->dhglrc)
282 goto no_hglrc;
283
284 return ctx->dhglrc;
285
286 no_hglrc:
287 if (ctx->hud) {
288 hud_destroy(ctx->hud);
289 }
290 ctx->st->destroy(ctx->st);
291 no_st_ctx:
292 FREE(ctx);
293 no_ctx:
294 return 0;
295 }
296
297
298 BOOL APIENTRY
299 DrvDeleteContext(DHGLRC dhglrc)
300 {
301 struct stw_context *ctx ;
302 BOOL ret = FALSE;
303
304 if (!stw_dev)
305 return FALSE;
306
307 stw_lock_contexts(stw_dev);
308 ctx = stw_lookup_context_locked(dhglrc);
309 handle_table_remove(stw_dev->ctx_table, dhglrc);
310 stw_unlock_contexts(stw_dev);
311
312 if (ctx) {
313 struct stw_context *curctx = stw_current_context();
314
315 /* Unbind current if deleting current context. */
316 if (curctx == ctx)
317 stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
318
319 if (ctx->hud) {
320 hud_destroy(ctx->hud);
321 }
322
323 ctx->st->destroy(ctx->st);
324 FREE(ctx);
325
326 ret = TRUE;
327 }
328
329 return ret;
330 }
331
332
333 BOOL APIENTRY
334 DrvReleaseContext(DHGLRC dhglrc)
335 {
336 struct stw_context *ctx;
337
338 if (!stw_dev)
339 return FALSE;
340
341 stw_lock_contexts(stw_dev);
342 ctx = stw_lookup_context_locked( dhglrc );
343 stw_unlock_contexts(stw_dev);
344
345 if (!ctx)
346 return FALSE;
347
348 /* The expectation is that ctx is the same context which is
349 * current for this thread. We should check that and return False
350 * if not the case.
351 */
352 if (ctx != stw_current_context())
353 return FALSE;
354
355 if (stw_make_current( NULL, 0 ) == FALSE)
356 return FALSE;
357
358 return TRUE;
359 }
360
361
362 DHGLRC
363 stw_get_current_context( void )
364 {
365 struct stw_context *ctx;
366
367 ctx = stw_current_context();
368 if (!ctx)
369 return 0;
370
371 return ctx->dhglrc;
372 }
373
374
375 HDC
376 stw_get_current_dc( void )
377 {
378 struct stw_context *ctx;
379
380 ctx = stw_current_context();
381 if (!ctx)
382 return NULL;
383
384 return ctx->hdc;
385 }
386
387
388 BOOL
389 stw_make_current(HDC hdc, DHGLRC dhglrc)
390 {
391 struct stw_context *curctx = NULL;
392 struct stw_context *ctx = NULL;
393 struct stw_framebuffer *fb = NULL;
394 BOOL ret = FALSE;
395
396 if (!stw_dev)
397 return FALSE;
398
399 curctx = stw_current_context();
400 if (curctx != NULL) {
401 if (curctx->dhglrc == dhglrc) {
402 if (curctx->hdc == hdc) {
403 /* Return if already current. */
404 return TRUE;
405 }
406 } else {
407 curctx->st->flush(curctx->st, ST_FLUSH_FRONT, NULL);
408 }
409 }
410
411 if (dhglrc) {
412 stw_lock_contexts(stw_dev);
413 ctx = stw_lookup_context_locked( dhglrc );
414 stw_unlock_contexts(stw_dev);
415 if (!ctx) {
416 goto fail;
417 }
418
419 fb = stw_framebuffer_from_hdc( hdc );
420 if (fb) {
421 stw_framebuffer_update(fb);
422 }
423 else {
424 /* Applications should call SetPixelFormat before creating a context,
425 * but not all do, and the opengl32 runtime seems to use a default
426 * pixel format in some cases, so we must create a framebuffer for
427 * those here.
428 */
429 int iPixelFormat = GetPixelFormat(hdc);
430 if (iPixelFormat)
431 fb = stw_framebuffer_create( hdc, iPixelFormat );
432 if (!fb)
433 goto fail;
434 }
435
436 if (fb->iPixelFormat != ctx->iPixelFormat) {
437 SetLastError(ERROR_INVALID_PIXEL_FORMAT);
438 goto fail;
439 }
440
441 /* Bind the new framebuffer */
442 ctx->hdc = hdc;
443
444 ret = stw_dev->stapi->make_current(stw_dev->stapi, ctx->st,
445 fb->stfb, fb->stfb);
446 stw_framebuffer_reference(&ctx->current_framebuffer, fb);
447 } else {
448 ret = stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
449 }
450
451 fail:
452
453 if (fb) {
454 stw_framebuffer_unlock(fb);
455 }
456
457 /* On failure, make the thread's current rendering context not current
458 * before returning.
459 */
460 if (!ret) {
461 stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
462 ctx = NULL;
463 }
464
465 /* Unreference the previous framebuffer if any. It must be done after
466 * make_current, as it can be referenced inside.
467 */
468 if (curctx && curctx != ctx) {
469 stw_framebuffer_reference(&curctx->current_framebuffer, NULL);
470 }
471
472 return ret;
473 }
474
475
476 /**
477 * Notify the current context that the framebuffer has become invalid.
478 */
479 void
480 stw_notify_current_locked( struct stw_framebuffer *fb )
481 {
482 p_atomic_inc(&fb->stfb->stamp);
483 }
484
485
486 /**
487 * Although WGL allows different dispatch entrypoints per context
488 */
489 static const GLCLTPROCTABLE cpt =
490 {
491 OPENGL_VERSION_110_ENTRIES,
492 {
493 &glNewList,
494 &glEndList,
495 &glCallList,
496 &glCallLists,
497 &glDeleteLists,
498 &glGenLists,
499 &glListBase,
500 &glBegin,
501 &glBitmap,
502 &glColor3b,
503 &glColor3bv,
504 &glColor3d,
505 &glColor3dv,
506 &glColor3f,
507 &glColor3fv,
508 &glColor3i,
509 &glColor3iv,
510 &glColor3s,
511 &glColor3sv,
512 &glColor3ub,
513 &glColor3ubv,
514 &glColor3ui,
515 &glColor3uiv,
516 &glColor3us,
517 &glColor3usv,
518 &glColor4b,
519 &glColor4bv,
520 &glColor4d,
521 &glColor4dv,
522 &glColor4f,
523 &glColor4fv,
524 &glColor4i,
525 &glColor4iv,
526 &glColor4s,
527 &glColor4sv,
528 &glColor4ub,
529 &glColor4ubv,
530 &glColor4ui,
531 &glColor4uiv,
532 &glColor4us,
533 &glColor4usv,
534 &glEdgeFlag,
535 &glEdgeFlagv,
536 &glEnd,
537 &glIndexd,
538 &glIndexdv,
539 &glIndexf,
540 &glIndexfv,
541 &glIndexi,
542 &glIndexiv,
543 &glIndexs,
544 &glIndexsv,
545 &glNormal3b,
546 &glNormal3bv,
547 &glNormal3d,
548 &glNormal3dv,
549 &glNormal3f,
550 &glNormal3fv,
551 &glNormal3i,
552 &glNormal3iv,
553 &glNormal3s,
554 &glNormal3sv,
555 &glRasterPos2d,
556 &glRasterPos2dv,
557 &glRasterPos2f,
558 &glRasterPos2fv,
559 &glRasterPos2i,
560 &glRasterPos2iv,
561 &glRasterPos2s,
562 &glRasterPos2sv,
563 &glRasterPos3d,
564 &glRasterPos3dv,
565 &glRasterPos3f,
566 &glRasterPos3fv,
567 &glRasterPos3i,
568 &glRasterPos3iv,
569 &glRasterPos3s,
570 &glRasterPos3sv,
571 &glRasterPos4d,
572 &glRasterPos4dv,
573 &glRasterPos4f,
574 &glRasterPos4fv,
575 &glRasterPos4i,
576 &glRasterPos4iv,
577 &glRasterPos4s,
578 &glRasterPos4sv,
579 &glRectd,
580 &glRectdv,
581 &glRectf,
582 &glRectfv,
583 &glRecti,
584 &glRectiv,
585 &glRects,
586 &glRectsv,
587 &glTexCoord1d,
588 &glTexCoord1dv,
589 &glTexCoord1f,
590 &glTexCoord1fv,
591 &glTexCoord1i,
592 &glTexCoord1iv,
593 &glTexCoord1s,
594 &glTexCoord1sv,
595 &glTexCoord2d,
596 &glTexCoord2dv,
597 &glTexCoord2f,
598 &glTexCoord2fv,
599 &glTexCoord2i,
600 &glTexCoord2iv,
601 &glTexCoord2s,
602 &glTexCoord2sv,
603 &glTexCoord3d,
604 &glTexCoord3dv,
605 &glTexCoord3f,
606 &glTexCoord3fv,
607 &glTexCoord3i,
608 &glTexCoord3iv,
609 &glTexCoord3s,
610 &glTexCoord3sv,
611 &glTexCoord4d,
612 &glTexCoord4dv,
613 &glTexCoord4f,
614 &glTexCoord4fv,
615 &glTexCoord4i,
616 &glTexCoord4iv,
617 &glTexCoord4s,
618 &glTexCoord4sv,
619 &glVertex2d,
620 &glVertex2dv,
621 &glVertex2f,
622 &glVertex2fv,
623 &glVertex2i,
624 &glVertex2iv,
625 &glVertex2s,
626 &glVertex2sv,
627 &glVertex3d,
628 &glVertex3dv,
629 &glVertex3f,
630 &glVertex3fv,
631 &glVertex3i,
632 &glVertex3iv,
633 &glVertex3s,
634 &glVertex3sv,
635 &glVertex4d,
636 &glVertex4dv,
637 &glVertex4f,
638 &glVertex4fv,
639 &glVertex4i,
640 &glVertex4iv,
641 &glVertex4s,
642 &glVertex4sv,
643 &glClipPlane,
644 &glColorMaterial,
645 &glCullFace,
646 &glFogf,
647 &glFogfv,
648 &glFogi,
649 &glFogiv,
650 &glFrontFace,
651 &glHint,
652 &glLightf,
653 &glLightfv,
654 &glLighti,
655 &glLightiv,
656 &glLightModelf,
657 &glLightModelfv,
658 &glLightModeli,
659 &glLightModeliv,
660 &glLineStipple,
661 &glLineWidth,
662 &glMaterialf,
663 &glMaterialfv,
664 &glMateriali,
665 &glMaterialiv,
666 &glPointSize,
667 &glPolygonMode,
668 &glPolygonStipple,
669 &glScissor,
670 &glShadeModel,
671 &glTexParameterf,
672 &glTexParameterfv,
673 &glTexParameteri,
674 &glTexParameteriv,
675 &glTexImage1D,
676 &glTexImage2D,
677 &glTexEnvf,
678 &glTexEnvfv,
679 &glTexEnvi,
680 &glTexEnviv,
681 &glTexGend,
682 &glTexGendv,
683 &glTexGenf,
684 &glTexGenfv,
685 &glTexGeni,
686 &glTexGeniv,
687 &glFeedbackBuffer,
688 &glSelectBuffer,
689 &glRenderMode,
690 &glInitNames,
691 &glLoadName,
692 &glPassThrough,
693 &glPopName,
694 &glPushName,
695 &glDrawBuffer,
696 &glClear,
697 &glClearAccum,
698 &glClearIndex,
699 &glClearColor,
700 &glClearStencil,
701 &glClearDepth,
702 &glStencilMask,
703 &glColorMask,
704 &glDepthMask,
705 &glIndexMask,
706 &glAccum,
707 &glDisable,
708 &glEnable,
709 &glFinish,
710 &glFlush,
711 &glPopAttrib,
712 &glPushAttrib,
713 &glMap1d,
714 &glMap1f,
715 &glMap2d,
716 &glMap2f,
717 &glMapGrid1d,
718 &glMapGrid1f,
719 &glMapGrid2d,
720 &glMapGrid2f,
721 &glEvalCoord1d,
722 &glEvalCoord1dv,
723 &glEvalCoord1f,
724 &glEvalCoord1fv,
725 &glEvalCoord2d,
726 &glEvalCoord2dv,
727 &glEvalCoord2f,
728 &glEvalCoord2fv,
729 &glEvalMesh1,
730 &glEvalPoint1,
731 &glEvalMesh2,
732 &glEvalPoint2,
733 &glAlphaFunc,
734 &glBlendFunc,
735 &glLogicOp,
736 &glStencilFunc,
737 &glStencilOp,
738 &glDepthFunc,
739 &glPixelZoom,
740 &glPixelTransferf,
741 &glPixelTransferi,
742 &glPixelStoref,
743 &glPixelStorei,
744 &glPixelMapfv,
745 &glPixelMapuiv,
746 &glPixelMapusv,
747 &glReadBuffer,
748 &glCopyPixels,
749 &glReadPixels,
750 &glDrawPixels,
751 &glGetBooleanv,
752 &glGetClipPlane,
753 &glGetDoublev,
754 &glGetError,
755 &glGetFloatv,
756 &glGetIntegerv,
757 &glGetLightfv,
758 &glGetLightiv,
759 &glGetMapdv,
760 &glGetMapfv,
761 &glGetMapiv,
762 &glGetMaterialfv,
763 &glGetMaterialiv,
764 &glGetPixelMapfv,
765 &glGetPixelMapuiv,
766 &glGetPixelMapusv,
767 &glGetPolygonStipple,
768 &glGetString,
769 &glGetTexEnvfv,
770 &glGetTexEnviv,
771 &glGetTexGendv,
772 &glGetTexGenfv,
773 &glGetTexGeniv,
774 &glGetTexImage,
775 &glGetTexParameterfv,
776 &glGetTexParameteriv,
777 &glGetTexLevelParameterfv,
778 &glGetTexLevelParameteriv,
779 &glIsEnabled,
780 &glIsList,
781 &glDepthRange,
782 &glFrustum,
783 &glLoadIdentity,
784 &glLoadMatrixf,
785 &glLoadMatrixd,
786 &glMatrixMode,
787 &glMultMatrixf,
788 &glMultMatrixd,
789 &glOrtho,
790 &glPopMatrix,
791 &glPushMatrix,
792 &glRotated,
793 &glRotatef,
794 &glScaled,
795 &glScalef,
796 &glTranslated,
797 &glTranslatef,
798 &glViewport,
799 &glArrayElement,
800 &glBindTexture,
801 &glColorPointer,
802 &glDisableClientState,
803 &glDrawArrays,
804 &glDrawElements,
805 &glEdgeFlagPointer,
806 &glEnableClientState,
807 &glIndexPointer,
808 &glIndexub,
809 &glIndexubv,
810 &glInterleavedArrays,
811 &glNormalPointer,
812 &glPolygonOffset,
813 &glTexCoordPointer,
814 &glVertexPointer,
815 &glAreTexturesResident,
816 &glCopyTexImage1D,
817 &glCopyTexImage2D,
818 &glCopyTexSubImage1D,
819 &glCopyTexSubImage2D,
820 &glDeleteTextures,
821 &glGenTextures,
822 &glGetPointerv,
823 &glIsTexture,
824 &glPrioritizeTextures,
825 &glTexSubImage1D,
826 &glTexSubImage2D,
827 &glPopClientAttrib,
828 &glPushClientAttrib
829 }
830 };
831
832
833 PGLCLTPROCTABLE APIENTRY
834 DrvSetContext(HDC hdc, DHGLRC dhglrc, PFN_SETPROCTABLE pfnSetProcTable)
835 {
836 PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt;
837
838 if (!stw_make_current(hdc, dhglrc))
839 r = NULL;
840
841 return r;
842 }