a220e59a55fbd7da307ce06ff4ff1cf3af108ff7
[mesa.git] / src / mesa / drivers / dri / r200 / r200_context.c
1 /* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.c,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */
2 /*
3 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
4
5 The Weather Channel (TM) funded Tungsten Graphics to develop the
6 initial release of the Radeon 8500 driver under the XFree86 license.
7 This notice must be preserved.
8
9 Permission is hereby granted, free of charge, to any person obtaining
10 a copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial
19 portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
25 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
29 **************************************************************************/
30
31 /*
32 * Authors:
33 * Keith Whitwell <keith@tungstengraphics.com>
34 */
35
36 #include "glheader.h"
37 #include "api_arrayelt.h"
38 #include "context.h"
39 #include "simple_list.h"
40 #include "imports.h"
41 #include "matrix.h"
42 #include "extensions.h"
43 #include "state.h"
44
45 #include "swrast/swrast.h"
46 #include "swrast_setup/swrast_setup.h"
47 #include "array_cache/acache.h"
48
49 #include "tnl/tnl.h"
50 #include "tnl/t_pipeline.h"
51
52 #include "r200_context.h"
53 #include "r200_ioctl.h"
54 #include "r200_state.h"
55 #include "r200_span.h"
56 #include "r200_pixel.h"
57 #include "r200_tex.h"
58 #include "r200_swtcl.h"
59 #include "r200_tcl.h"
60 #include "r200_vtxfmt.h"
61 #include "r200_maos.h"
62
63 #define DRIVER_DATE "20030328"
64
65 #include "vblank.h"
66 #include "utils.h"
67 #include "xmlpool.h" /* for symbolic values of enum-type options */
68 #ifndef R200_DEBUG
69 int R200_DEBUG = (0);
70 #endif
71
72
73 /* Return the width and height of the given buffer.
74 */
75 static void r200GetBufferSize( GLframebuffer *buffer,
76 GLuint *width, GLuint *height )
77 {
78 GET_CURRENT_CONTEXT(ctx);
79 r200ContextPtr rmesa = R200_CONTEXT(ctx);
80
81 LOCK_HARDWARE( rmesa );
82 *width = rmesa->dri.drawable->w;
83 *height = rmesa->dri.drawable->h;
84 UNLOCK_HARDWARE( rmesa );
85 }
86
87 /* Return various strings for glGetString().
88 */
89 static const GLubyte *r200GetString( GLcontext *ctx, GLenum name )
90 {
91 r200ContextPtr rmesa = R200_CONTEXT(ctx);
92 static char buffer[128];
93 unsigned offset;
94 GLuint agp_mode = rmesa->r200Screen->IsPCI ? 0 :
95 rmesa->r200Screen->AGPMode;
96
97 switch ( name ) {
98 case GL_VENDOR:
99 return (GLubyte *)"Tungsten Graphics, Inc.";
100
101 case GL_RENDERER:
102 offset = driGetRendererString( buffer, "R200", DRIVER_DATE,
103 agp_mode );
104
105 sprintf( & buffer[ offset ], " %sTCL",
106 !(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)
107 ? "" : "NO-" );
108
109 return (GLubyte *)buffer;
110
111 default:
112 return NULL;
113 }
114 }
115
116
117 /* Extension strings exported by the R200 driver.
118 */
119 static const char * const card_extensions[] =
120 {
121 "GL_ARB_multisample",
122 "GL_ARB_multitexture",
123 "GL_ARB_texture_border_clamp",
124 "GL_ARB_texture_compression",
125 "GL_ARB_texture_env_add",
126 "GL_ARB_texture_env_combine",
127 "GL_ARB_texture_env_dot3",
128 "GL_ARB_texture_mirrored_repeat",
129 "GL_EXT_blend_logic_op",
130 "GL_EXT_blend_minmax",
131 "GL_EXT_blend_subtract",
132 "GL_EXT_secondary_color",
133 "GL_EXT_stencil_wrap",
134 "GL_EXT_texture_edge_clamp",
135 "GL_EXT_texture_env_combine",
136 "GL_EXT_texture_env_dot3",
137 "GL_EXT_texture_filter_anisotropic",
138 "GL_EXT_texture_lod_bias",
139 "GL_EXT_texture_rectangle",
140 "GL_ATI_texture_env_combine3",
141 "GL_ATI_texture_mirror_once",
142 "GL_MESA_pack_invert",
143 "GL_MESA_ycbcr_texture",
144 "GL_NV_blend_square",
145 "GL_SGIS_generate_mipmap",
146 NULL
147 };
148
149 extern const struct tnl_pipeline_stage _r200_render_stage;
150 extern const struct tnl_pipeline_stage _r200_tcl_stage;
151
152 static const struct tnl_pipeline_stage *r200_pipeline[] = {
153
154 /* Try and go straight to t&l
155 */
156 &_r200_tcl_stage,
157
158 /* Catch any t&l fallbacks
159 */
160 &_tnl_vertex_transform_stage,
161 &_tnl_normal_transform_stage,
162 &_tnl_lighting_stage,
163 &_tnl_fog_coordinate_stage,
164 &_tnl_texgen_stage,
165 &_tnl_texture_transform_stage,
166
167 /* Try again to go to tcl?
168 * - no good for asymmetric-twoside (do with multipass)
169 * - no good for asymmetric-unfilled (do with multipass)
170 * - good for material
171 * - good for texgen
172 * - need to manipulate a bit of state
173 *
174 * - worth it/not worth it?
175 */
176
177 /* Else do them here.
178 */
179 /* &_r200_render_stage, */ /* FIXME: bugs with ut2003 */
180 &_tnl_render_stage, /* FALLBACK: */
181 0,
182 };
183
184
185
186 /* Initialize the driver's misc functions.
187 */
188 static void r200InitDriverFuncs( GLcontext *ctx )
189 {
190 ctx->Driver.GetBufferSize = r200GetBufferSize;
191 ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
192 ctx->Driver.GetString = r200GetString;
193
194 ctx->Driver.Error = NULL;
195 ctx->Driver.DrawPixels = NULL;
196 ctx->Driver.Bitmap = NULL;
197 }
198
199 static const struct dri_debug_control debug_control[] =
200 {
201 { "fall", DEBUG_FALLBACKS },
202 { "tex", DEBUG_TEXTURE },
203 { "ioctl", DEBUG_IOCTL },
204 { "prim", DEBUG_PRIMS },
205 { "vert", DEBUG_VERTS },
206 { "state", DEBUG_STATE },
207 { "code", DEBUG_CODEGEN },
208 { "vfmt", DEBUG_VFMT },
209 { "vtxf", DEBUG_VFMT },
210 { "verb", DEBUG_VERBOSE },
211 { "dri", DEBUG_DRI },
212 { "dma", DEBUG_DMA },
213 { "san", DEBUG_SANITY },
214 { "sync", DEBUG_SYNC },
215 { "pix", DEBUG_PIXEL },
216 { "mem", DEBUG_MEMORY },
217 { NULL, 0 }
218 };
219
220
221 static int
222 get_ust_nop( int64_t * ust )
223 {
224 *ust = 1;
225 return 0;
226 }
227
228
229 /* Create the device specific context.
230 */
231 GLboolean r200CreateContext( const __GLcontextModes *glVisual,
232 __DRIcontextPrivate *driContextPriv,
233 void *sharedContextPrivate)
234 {
235 __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
236 r200ScreenPtr screen = (r200ScreenPtr)(sPriv->private);
237 r200ContextPtr rmesa;
238 GLcontext *ctx, *shareCtx;
239 int i;
240 int tcl_mode, fthrottle_mode;
241
242 assert(glVisual);
243 assert(driContextPriv);
244 assert(screen);
245
246 /* Allocate the R200 context */
247 rmesa = (r200ContextPtr) CALLOC( sizeof(*rmesa) );
248 if ( !rmesa )
249 return GL_FALSE;
250
251 /* Allocate the Mesa context */
252 if (sharedContextPrivate)
253 shareCtx = ((r200ContextPtr) sharedContextPrivate)->glCtx;
254 else
255 shareCtx = NULL;
256 rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
257 if (!rmesa->glCtx) {
258 FREE(rmesa);
259 return GL_FALSE;
260 }
261 driContextPriv->driverPrivate = rmesa;
262
263 /* Init r200 context data */
264 rmesa->dri.context = driContextPriv;
265 rmesa->dri.screen = sPriv;
266 rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
267 rmesa->dri.hwContext = driContextPriv->hHWContext;
268 rmesa->dri.hwLock = &sPriv->pSAREA->lock;
269 rmesa->dri.fd = sPriv->fd;
270 rmesa->dri.drmMinor = sPriv->drmMinor;
271
272 /* Parse configuration files */
273 driParseConfigFiles (&rmesa->optionCache, &screen->optionCache,
274 screen->driScreen->myNum, "r200");
275
276 rmesa->r200Screen = screen;
277 rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA +
278 screen->sarea_priv_offset);
279
280
281 rmesa->dma.buf0_address = rmesa->r200Screen->buffers->list[0].address;
282
283 (void) memset( rmesa->texture_heaps, 0, sizeof( rmesa->texture_heaps ) );
284 make_empty_list( & rmesa->swapped );
285
286 rmesa->nr_heaps = 1 /* screen->numTexHeaps */ ;
287 for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
288 rmesa->texture_heaps[i] = driCreateTextureHeap( i, rmesa,
289 screen->texSize[i],
290 12,
291 RADEON_NR_TEX_REGIONS,
292 rmesa->sarea->texList[i],
293 & rmesa->sarea->texAge[i],
294 & rmesa->swapped,
295 sizeof( r200TexObj ),
296 (destroy_texture_object_t *) r200DestroyTexObj );
297 }
298 rmesa->texture_depth = driQueryOptioni (&rmesa->optionCache,
299 "texture_depth");
300 if (rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
301 rmesa->texture_depth = ( screen->cpp == 4 ) ?
302 DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
303
304 rmesa->swtcl.RenderIndex = ~0;
305 rmesa->lost_context = 1;
306
307 /* Set the maximum texture size small enough that we can guarentee that
308 * all texture units can bind a maximal texture and have them both in
309 * texturable memory at once.
310 */
311
312 ctx = rmesa->glCtx;
313 ctx->Const.MaxTextureUnits = 2;
314 ctx->Const.MaxTextureImageUnits = 2;
315 ctx->Const.MaxTextureCoordUnits = 2;
316
317 driCalculateMaxTextureLevels( rmesa->texture_heaps,
318 rmesa->nr_heaps,
319 & ctx->Const,
320 4,
321 11, /* max 2D texture size is 2048x2048 */
322 #if ENABLE_HW_3D_TEXTURE
323 8, /* max 3D texture size is 256^3 */
324 #else
325 0, /* 3D textures unsupported */
326 #endif
327 11, /* max cube texture size is 2048x2048 */
328 11, /* max texture rectangle size is 2048x2048 */
329 12,
330 GL_FALSE );
331
332 ctx->Const.MaxTextureMaxAnisotropy = 16.0;
333
334 /* No wide points.
335 */
336 ctx->Const.MinPointSize = 1.0;
337 ctx->Const.MinPointSizeAA = 1.0;
338 ctx->Const.MaxPointSize = 1.0;
339 ctx->Const.MaxPointSizeAA = 1.0;
340
341 ctx->Const.MinLineWidth = 1.0;
342 ctx->Const.MinLineWidthAA = 1.0;
343 ctx->Const.MaxLineWidth = 10.0;
344 ctx->Const.MaxLineWidthAA = 10.0;
345 ctx->Const.LineWidthGranularity = 0.0625;
346
347 /* Initialize the software rasterizer and helper modules.
348 */
349 _swrast_CreateContext( ctx );
350 _ac_CreateContext( ctx );
351 _tnl_CreateContext( ctx );
352 _swsetup_CreateContext( ctx );
353 _ae_create_context( ctx );
354
355 /* Install the customized pipeline:
356 */
357 _tnl_destroy_pipeline( ctx );
358 _tnl_install_pipeline( ctx, r200_pipeline );
359 ctx->Driver.FlushVertices = r200FlushVertices;
360
361 /* Try and keep materials and vertices separate:
362 */
363 _tnl_isolate_materials( ctx, GL_TRUE );
364
365
366 /* Configure swrast to match hardware characteristics:
367 */
368 _swrast_allow_pixel_fog( ctx, GL_FALSE );
369 _swrast_allow_vertex_fog( ctx, GL_TRUE );
370
371
372 _math_matrix_ctr( &rmesa->TexGenMatrix[0] );
373 _math_matrix_ctr( &rmesa->TexGenMatrix[1] );
374 _math_matrix_ctr( &rmesa->tmpmat );
375 _math_matrix_set_identity( &rmesa->TexGenMatrix[0] );
376 _math_matrix_set_identity( &rmesa->TexGenMatrix[1] );
377 _math_matrix_set_identity( &rmesa->tmpmat );
378
379 driInitExtensions( ctx, card_extensions, GL_TRUE );
380 if (rmesa->r200Screen->drmSupportsCubeMaps)
381 _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
382
383 r200InitDriverFuncs( ctx );
384 r200InitIoctlFuncs( ctx );
385 r200InitStateFuncs( ctx );
386 r200InitSpanFuncs( ctx );
387 r200InitPixelFuncs( ctx );
388 r200InitTextureFuncs( ctx );
389 r200InitState( rmesa );
390 r200InitSwtcl( ctx );
391
392 fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode");
393 rmesa->iw.irq_seq = -1;
394 rmesa->irqsEmitted = 0;
395 rmesa->do_irqs = (rmesa->dri.drmMinor >= 6 &&
396 fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS &&
397 rmesa->r200Screen->irq);
398
399 rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
400
401 if (!rmesa->do_irqs)
402 fprintf(stderr,
403 "IRQ's not enabled, falling back to %s: %d %d %d\n",
404 rmesa->do_usleeps ? "usleeps" : "busy waits",
405 rmesa->dri.drmMinor,
406 fthrottle_mode,
407 rmesa->r200Screen->irq);
408
409 rmesa->vblank_flags = (rmesa->r200Screen->irq != 0)
410 ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
411
412 rmesa->prefer_gart_client_texturing =
413 (getenv("R200_GART_CLIENT_TEXTURES") != 0);
414 #ifndef _SOLO
415 rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" );
416 if ( rmesa->get_ust == NULL ) {
417 rmesa->get_ust = get_ust_nop;
418 }
419 #else
420 rmesa->get_ust = get_ust_nop;
421 #endif
422 (*rmesa->get_ust)( & rmesa->swap_ust );
423
424
425 #if DO_DEBUG
426 R200_DEBUG = driParseDebugString( getenv( "R200_DEBUG" ),
427 debug_control );
428 R200_DEBUG |= driParseDebugString( getenv( "RADEON_DEBUG" ),
429 debug_control );
430 #endif
431
432 tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
433 if (driQueryOptionb(&rmesa->optionCache, "no_rast")) {
434 fprintf(stderr, "disabling 3D acceleration\n");
435 FALLBACK(rmesa, R200_FALLBACK_DISABLE, 1);
436 }
437 else if (tcl_mode == DRI_CONF_TCL_SW || getenv("R200_NO_TCL") ||
438 !(rmesa->r200Screen->chipset & R200_CHIPSET_TCL)) {
439 rmesa->r200Screen->chipset &= ~R200_CHIPSET_TCL;
440 fprintf(stderr, "disabling TCL support\n");
441 TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1);
442 }
443 if (rmesa->r200Screen->chipset & R200_CHIPSET_TCL) {
444 if (tcl_mode >= DRI_CONF_TCL_VTXFMT && !getenv("R200_NO_VTXFMT")) {
445 r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN );
446 }
447 _tnl_need_dlist_norm_lengths( ctx, GL_FALSE );
448 }
449 return GL_TRUE;
450 }
451
452
453 /* Destroy the device specific context.
454 */
455 /* Destroy the Mesa and driver specific context data.
456 */
457 void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
458 {
459 GET_CURRENT_CONTEXT(ctx);
460 r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
461 r200ContextPtr current = ctx ? R200_CONTEXT(ctx) : NULL;
462
463 /* check if we're deleting the currently bound context */
464 if (rmesa == current) {
465 R200_FIREVERTICES( rmesa );
466 _mesa_make_current2(NULL, NULL, NULL);
467 }
468
469 /* Free r200 context resources */
470 assert(rmesa); /* should never be null */
471 if ( rmesa ) {
472 GLboolean release_texture_heaps;
473
474
475 release_texture_heaps = (rmesa->glCtx->Shared->RefCount == 1);
476 _swsetup_DestroyContext( rmesa->glCtx );
477 _tnl_DestroyContext( rmesa->glCtx );
478 _ac_DestroyContext( rmesa->glCtx );
479 _swrast_DestroyContext( rmesa->glCtx );
480
481 r200DestroySwtcl( rmesa->glCtx );
482 r200ReleaseArrays( rmesa->glCtx, ~0 );
483
484 if (rmesa->dma.current.buf) {
485 r200ReleaseDmaRegion( rmesa, &rmesa->dma.current, __FUNCTION__ );
486 r200FlushCmdBuf( rmesa, __FUNCTION__ );
487 }
488
489 if (!(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)) {
490 int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode");
491 if (tcl_mode >= DRI_CONF_TCL_VTXFMT)
492 r200VtxfmtDestroy( rmesa->glCtx );
493 }
494
495 /* free the Mesa context */
496 rmesa->glCtx->DriverCtx = NULL;
497 _mesa_destroy_context( rmesa->glCtx );
498
499 if (rmesa->state.scissor.pClipRects) {
500 FREE(rmesa->state.scissor.pClipRects);
501 rmesa->state.scissor.pClipRects = 0;
502 }
503
504 if ( release_texture_heaps ) {
505 /* This share group is about to go away, free our private
506 * texture object data.
507 */
508 int i;
509
510 for ( i = 0 ; i < rmesa->nr_heaps ; i++ ) {
511 driDestroyTextureHeap( rmesa->texture_heaps[ i ] );
512 rmesa->texture_heaps[ i ] = NULL;
513 }
514
515 assert( is_empty_list( & rmesa->swapped ) );
516 }
517
518 /* free the option cache */
519 driDestroyOptionCache (&rmesa->optionCache);
520
521 FREE( rmesa );
522 }
523 }
524
525
526
527
528 void
529 r200SwapBuffers( __DRIdrawablePrivate *dPriv )
530 {
531 if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
532 r200ContextPtr rmesa;
533 GLcontext *ctx;
534 rmesa = (r200ContextPtr) dPriv->driContextPriv->driverPrivate;
535 ctx = rmesa->glCtx;
536 if (ctx->Visual.doubleBufferMode) {
537 _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
538 if ( rmesa->doPageFlip ) {
539 r200PageFlip( dPriv );
540 }
541 else {
542 r200CopyBuffer( dPriv );
543 }
544 }
545 }
546 else {
547 /* XXX this shouldn't be an error but we can't handle it for now */
548 _mesa_problem(NULL, "%s: drawable has no context!", __FUNCTION__);
549 }
550 }
551
552
553 /* Force the context `c' to be the current context and associate with it
554 * buffer `b'.
555 */
556 GLboolean
557 r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
558 __DRIdrawablePrivate *driDrawPriv,
559 __DRIdrawablePrivate *driReadPriv )
560 {
561 if ( driContextPriv ) {
562 r200ContextPtr newCtx =
563 (r200ContextPtr) driContextPriv->driverPrivate;
564
565 if (R200_DEBUG & DEBUG_DRI)
566 fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx);
567
568 if ( newCtx->dri.drawable != driDrawPriv ) {
569 driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags );
570 newCtx->dri.drawable = driDrawPriv;
571 r200UpdateWindow( newCtx->glCtx );
572 r200UpdateViewportOffset( newCtx->glCtx );
573 }
574
575 _mesa_make_current2( newCtx->glCtx,
576 (GLframebuffer *) driDrawPriv->driverPrivate,
577 (GLframebuffer *) driReadPriv->driverPrivate );
578
579 if ( !newCtx->glCtx->Viewport.Width ) {
580 _mesa_set_viewport( newCtx->glCtx, 0, 0,
581 driDrawPriv->w, driDrawPriv->h );
582 }
583
584 if (newCtx->vb.enabled)
585 r200VtxfmtMakeCurrent( newCtx->glCtx );
586
587 _mesa_update_state( newCtx->glCtx );
588 r200ValidateState( newCtx->glCtx );
589
590 } else {
591 if (R200_DEBUG & DEBUG_DRI)
592 fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
593 _mesa_make_current( 0, 0 );
594 }
595
596 if (R200_DEBUG & DEBUG_DRI)
597 fprintf(stderr, "End %s\n", __FUNCTION__);
598 return GL_TRUE;
599 }
600
601 /* Force the context `c' to be unbound from its buffer.
602 */
603 GLboolean
604 r200UnbindContext( __DRIcontextPrivate *driContextPriv )
605 {
606 r200ContextPtr rmesa = (r200ContextPtr) driContextPriv->driverPrivate;
607
608 if (R200_DEBUG & DEBUG_DRI)
609 fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)rmesa->glCtx);
610
611 r200VtxfmtUnbindContext( rmesa->glCtx );
612 return GL_TRUE;
613 }