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