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