1 /**************************************************************************
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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 TUNGSTEN GRAPHICS 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.
26 **************************************************************************/
32 #include "simple_list.h"
33 #include "extensions.h"
36 #include "swrast/swrast.h"
37 #include "swrast_setup/swrast_setup.h"
39 #include "array_cache/acache.h"
41 #include "tnl/t_pipeline.h"
42 #include "tnl/t_vertex.h"
44 #include "drivers/common/driverfuncs.h"
46 #include "intel_screen.h"
49 #include "i830_common.h"
51 #include "intel_tex.h"
52 #include "intel_span.h"
53 #include "intel_tris.h"
54 #include "intel_ioctl.h"
55 #include "intel_batchbuffer.h"
59 int INTEL_DEBUG
= (0);
71 /***************************************
72 * Mesa's Driver Functions
73 ***************************************/
75 #define DRIVER_DATE "20041007"
77 const GLubyte
*intelGetString( GLcontext
*ctx
, GLenum name
)
80 static char buffer
[128];
84 return (GLubyte
*)"Tungsten Graphics, Inc";
88 switch (INTEL_CONTEXT(ctx
)->intelScreen
->deviceID
) {
90 chipset
= "Intel(R) 845G"; break;
92 chipset
= "Intel(R) 830M"; break;
93 case PCI_CHIP_I855_GM
:
94 chipset
= "Intel(R) 852GM/855GM"; break;
96 chipset
= "Intel(R) 865G"; break;
98 chipset
= "Intel(R) 915G"; break;
100 chipset
= "Unknown Intel Chipset"; break;
103 (void) driGetRendererString( buffer
, chipset
, DRIVER_DATE
, 0 );
104 return (GLubyte
*) buffer
;
111 static void intelBufferSize(GLframebuffer
*buffer
,
112 GLuint
*width
, GLuint
*height
)
114 GET_CURRENT_CONTEXT(ctx
);
115 intelContextPtr intel
= INTEL_CONTEXT(ctx
);
116 /* Need to lock to make sure the driDrawable is uptodate. This
117 * information is used to resize Mesa's software buffers, so it has
120 LOCK_HARDWARE(intel
);
121 *width
= intel
->driDrawable
->w
;
122 *height
= intel
->driDrawable
->h
;
123 UNLOCK_HARDWARE(intel
);
129 * Extension strings exported by the intel driver.
132 * It appears that ARB_texture_env_crossbar and NV_blend_square have
133 * "disappeared" compared to the old i830-specific driver.
136 * See implementation of \c glGetString in each hw_context.c file:
137 * This set of extensions is overridden and many are not actually
138 * exported to the driver. They are however enabled internally as
139 * Mesa requires this when calculating things like GL version number.
141 static const char * const card_extensions
[] =
143 "GL_ARB_multisample",
144 "GL_ARB_multitexture",
145 "GL_ARB_point_parameters",
146 "GL_ARB_texture_border_clamp",
147 "GL_ARB_texture_cube_map",
148 "GL_ARB_texture_compression",
149 "GL_ARB_texture_env_add",
150 "GL_ARB_texture_env_combine",
151 "GL_ARB_texture_env_dot3",
152 "GL_ARB_texture_mirrored_repeat",
153 "GL_ARB_texture_rectangle",
154 "GL_ARB_vertex_buffer_object",
155 "GL_ARB_vertex_program",
160 "GL_EXT_blend_color",
161 "GL_EXT_blend_equation_separate",
162 "GL_EXT_blend_func_separate",
163 "GL_EXT_blend_minmax",
164 "GL_EXT_blend_subtract",
166 "GL_EXT_multi_draw_arrays",
167 "GL_EXT_secondary_color",
168 "GL_EXT_stencil_wrap",
169 "GL_EXT_texture_edge_clamp",
170 "GL_EXT_texture_env_combine",
171 "GL_EXT_texture_env_dot3",
172 "GL_EXT_texture_filter_anisotropic",
173 "GL_EXT_texture_lod_bias",
175 "GL_3DFX_texture_compression_FXT1",
176 "GL_APPLE_client_storage",
177 "GL_MESA_pack_invert",
178 "GL_MESA_ycbcr_texture",
179 "GL_NV_vertex_program",
180 "GL_NV_vertex_program1_1",
181 "GL_SGIS_generate_mipmap",
187 extern const struct tnl_pipeline_stage _intel_render_stage
;
189 static const struct tnl_pipeline_stage
*intel_pipeline
[] = {
190 &_tnl_vertex_transform_stage
,
191 &_tnl_normal_transform_stage
,
192 &_tnl_lighting_stage
,
193 &_tnl_fog_coordinate_stage
,
195 &_tnl_texture_transform_stage
,
196 &_tnl_point_attenuation_stage
,
197 &_tnl_vertex_program_stage
,
199 &_intel_render_stage
, /* ADD: unclipped rastersetup-to-dma */
206 static const struct dri_debug_control debug_control
[] =
208 { "fall", DEBUG_FALLBACKS
},
209 { "tex", DEBUG_TEXTURE
},
210 { "ioctl", DEBUG_IOCTL
},
211 { "prim", DEBUG_PRIMS
},
212 { "vert", DEBUG_VERTS
},
213 { "state", DEBUG_STATE
},
214 { "verb", DEBUG_VERBOSE
},
215 { "dri", DEBUG_DRI
},
216 { "dma", DEBUG_DMA
},
217 { "san", DEBUG_SANITY
},
218 { "sync", DEBUG_SYNC
},
219 { "sleep", DEBUG_SLEEP
},
220 { "pix", DEBUG_PIXEL
},
225 static void intelInvalidateState( GLcontext
*ctx
, GLuint new_state
)
227 _swrast_InvalidateState( ctx
, new_state
);
228 _swsetup_InvalidateState( ctx
, new_state
);
229 _ac_InvalidateState( ctx
, new_state
);
230 _tnl_InvalidateState( ctx
, new_state
);
231 _tnl_invalidate_vertex_state( ctx
, new_state
);
232 INTEL_CONTEXT(ctx
)->NewGLState
|= new_state
;
236 void intelInitDriverFunctions( struct dd_function_table
*functions
)
238 _mesa_init_driver_functions( functions
);
240 functions
->Flush
= intelFlush
;
241 functions
->Clear
= intelClear
;
242 functions
->Finish
= intelFinish
;
243 functions
->GetBufferSize
= intelBufferSize
;
244 functions
->ResizeBuffers
= _swrast_alloc_buffers
;
245 functions
->GetString
= intelGetString
;
246 functions
->UpdateState
= intelInvalidateState
;
247 functions
->CopyColorTable
= _swrast_CopyColorTable
;
248 functions
->CopyColorSubTable
= _swrast_CopyColorSubTable
;
249 functions
->CopyConvolutionFilter1D
= _swrast_CopyConvolutionFilter1D
;
250 functions
->CopyConvolutionFilter2D
= _swrast_CopyConvolutionFilter2D
;
252 intelInitTextureFuncs( functions
);
253 intelInitPixelFuncs( functions
);
254 intelInitStateFuncs( functions
);
259 GLboolean
intelInitContext( intelContextPtr intel
,
260 const __GLcontextModes
*mesaVis
,
261 __DRIcontextPrivate
*driContextPriv
,
262 void *sharedContextPrivate
,
263 struct dd_function_table
*functions
)
265 GLcontext
*ctx
= &intel
->ctx
;
266 GLcontext
*shareCtx
= (GLcontext
*) sharedContextPrivate
;
267 __DRIscreenPrivate
*sPriv
= driContextPriv
->driScreenPriv
;
268 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
269 drmI830Sarea
*saPriv
= (drmI830Sarea
*)
270 (((GLubyte
*)sPriv
->pSAREA
)+intelScreen
->sarea_priv_offset
);
272 if (!_mesa_initialize_context(&intel
->ctx
,
278 driContextPriv
->driverPrivate
= intel
;
279 intel
->intelScreen
= intelScreen
;
280 intel
->driScreen
= sPriv
;
281 intel
->sarea
= saPriv
;
284 (void) memset( intel
->texture_heaps
, 0, sizeof( intel
->texture_heaps
) );
285 make_empty_list( & intel
->swapped
);
287 ctx
->Const
.MaxTextureMaxAnisotropy
= 2.0;
289 ctx
->Const
.MinLineWidth
= 1.0;
290 ctx
->Const
.MinLineWidthAA
= 1.0;
291 ctx
->Const
.MaxLineWidth
= 3.0;
292 ctx
->Const
.MaxLineWidthAA
= 3.0;
293 ctx
->Const
.LineWidthGranularity
= 1.0;
295 ctx
->Const
.MinPointSize
= 1.0;
296 ctx
->Const
.MinPointSizeAA
= 1.0;
297 ctx
->Const
.MaxPointSize
= 255.0;
298 ctx
->Const
.MaxPointSizeAA
= 3.0;
299 ctx
->Const
.PointSizeGranularity
= 1.0;
301 /* Initialize the software rasterizer and helper modules. */
302 _swrast_CreateContext( ctx
);
303 _ac_CreateContext( ctx
);
304 _tnl_CreateContext( ctx
);
305 _swsetup_CreateContext( ctx
);
307 /* Install the customized pipeline: */
308 _tnl_destroy_pipeline( ctx
);
309 _tnl_install_pipeline( ctx
, intel_pipeline
);
311 /* Configure swrast to match hardware characteristics: */
312 _swrast_allow_pixel_fog( ctx
, GL_FALSE
);
313 _swrast_allow_vertex_fog( ctx
, GL_TRUE
);
316 intel
->hHWContext
= driContextPriv
->hHWContext
;
317 intel
->driFd
= sPriv
->fd
;
318 intel
->driHwLock
= (drmLock
*) &sPriv
->pSAREA
->lock
;
320 intel
->hw_stencil
= mesaVis
->stencilBits
&& mesaVis
->depthBits
== 24;
321 intel
->hw_stipple
= 1;
323 switch(mesaVis
->depthBits
) {
324 case 0: /* what to do in this case? */
326 intel
->depth_scale
= 1.0/0xffff;
327 intel
->polygon_offset_scale
= 1.0/0xffff;
328 intel
->depth_clear_mask
= ~0;
329 intel
->ClearDepth
= 0xffff;
332 intel
->depth_scale
= 1.0/0xffffff;
333 intel
->polygon_offset_scale
= 2.0/0xffffff; /* req'd to pass glean */
334 intel
->depth_clear_mask
= 0x00ffffff;
335 intel
->stencil_clear_mask
= 0xff000000;
336 intel
->ClearDepth
= 0x00ffffff;
343 /* Initialize swrast, tnl driver tables: */
344 intelInitSpanFuncs( ctx
);
345 intelInitTriFuncs( ctx
);
348 intel
->RenderIndex
= ~0;
350 intel
->do_irqs
= (intel
->intelScreen
->irq_active
&&
351 !getenv("INTEL_NO_IRQS"));
353 _math_matrix_ctr (&intel
->ViewportMatrix
);
355 driInitExtensions( ctx
, card_extensions
, GL_TRUE
);
357 if (intel
->ctx
.Mesa_DXTn
) {
358 _mesa_enable_extension( ctx
, "GL_EXT_texture_compression_s3tc" );
359 _mesa_enable_extension( ctx
, "GL_S3_s3tc" );
361 else if (driQueryOptionb (&intelScreen
->optionCache
, "force_s3tc_enable")) {
362 _mesa_enable_extension( ctx
, "GL_EXT_texture_compression_s3tc" );
365 /* driInitTextureObjects( ctx, & intel->swapped, */
366 /* DRI_TEXMGR_DO_TEXTURE_1D | */
367 /* DRI_TEXMGR_DO_TEXTURE_2D | */
368 /* DRI_TEXMGR_DO_TEXTURE_RECT ); */
371 intel
->prim
.flush
= intelInitBatchBuffer
;
372 intel
->prim
.primitive
= ~0;
376 INTEL_DEBUG
= driParseDebugString( getenv( "INTEL_DEBUG" ),
378 INTEL_DEBUG
|= driParseDebugString( getenv( "INTEL_DEBUG" ),
383 if (getenv("INTEL_VERBOSE"))
387 if (getenv("INTEL_NO_RAST") ||
388 getenv("INTEL_NO_RAST")) {
389 fprintf(stderr
, "disabling 3D rasterization\n");
390 FALLBACK(intel
, INTEL_FALLBACK_USER
, 1);
396 void intelDestroyContext(__DRIcontextPrivate
*driContextPriv
)
398 intelContextPtr intel
= (intelContextPtr
) driContextPriv
->driverPrivate
;
400 assert(intel
); /* should never be null */
402 GLboolean release_texture_heaps
;
405 intel
->vtbl
.destroy( intel
);
407 release_texture_heaps
= (intel
->ctx
.Shared
->RefCount
== 1);
408 _swsetup_DestroyContext (&intel
->ctx
);
409 _tnl_DestroyContext (&intel
->ctx
);
410 _ac_DestroyContext (&intel
->ctx
);
412 _swrast_DestroyContext (&intel
->ctx
);
413 intel
->Fallback
= 0; /* don't call _swrast_Flush later */
415 intelDestroyBatchBuffer(&intel
->ctx
);
418 if ( release_texture_heaps
) {
419 /* This share group is about to go away, free our private
420 * texture object data.
424 for ( i
= 0 ; i
< intel
->nr_heaps
; i
++ ) {
425 driDestroyTextureHeap( intel
->texture_heaps
[ i
] );
426 intel
->texture_heaps
[ i
] = NULL
;
429 assert( is_empty_list( & intel
->swapped
) );
432 /* free the Mesa context */
433 _mesa_destroy_context(&intel
->ctx
);
437 void intelSetFrontClipRects( intelContextPtr intel
)
439 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
443 intel
->numClipRects
= dPriv
->numClipRects
;
444 intel
->pClipRects
= dPriv
->pClipRects
;
445 intel
->drawX
= dPriv
->x
;
446 intel
->drawY
= dPriv
->y
;
450 void intelSetBackClipRects( intelContextPtr intel
)
452 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
456 if (intel
->sarea
->pf_enabled
== 0 && dPriv
->numBackClipRects
== 0) {
457 intel
->numClipRects
= dPriv
->numClipRects
;
458 intel
->pClipRects
= dPriv
->pClipRects
;
459 intel
->drawX
= dPriv
->x
;
460 intel
->drawY
= dPriv
->y
;
462 intel
->numClipRects
= dPriv
->numBackClipRects
;
463 intel
->pClipRects
= dPriv
->pBackClipRects
;
464 intel
->drawX
= dPriv
->backX
;
465 intel
->drawY
= dPriv
->backY
;
467 if (dPriv
->numBackClipRects
== 1 &&
468 dPriv
->x
== dPriv
->backX
&&
469 dPriv
->y
== dPriv
->backY
) {
471 /* Repeat the calculation of the back cliprect dimensions here
472 * as early versions of dri.a in the Xserver are incorrect. Try
473 * very hard not to restrict future versions of dri.a which
474 * might eg. allocate truly private back buffers.
481 x2
= dPriv
->x
+ dPriv
->w
;
482 y2
= dPriv
->y
+ dPriv
->h
;
486 if (x2
> intel
->intelScreen
->width
) x2
= intel
->intelScreen
->width
;
487 if (y2
> intel
->intelScreen
->height
) y2
= intel
->intelScreen
->height
;
489 if (x1
== dPriv
->pBackClipRects
[0].x1
&&
490 y1
== dPriv
->pBackClipRects
[0].y1
) {
492 dPriv
->pBackClipRects
[0].x2
= x2
;
493 dPriv
->pBackClipRects
[0].y2
= y2
;
500 void intelWindowMoved( intelContextPtr intel
)
502 switch (intel
->ctx
.Color
._DrawDestMask
[0]) {
503 case DD_FRONT_LEFT_BIT
:
504 intelSetFrontClipRects( intel
);
506 case DD_BACK_LEFT_BIT
:
507 intelSetBackClipRects( intel
);
510 /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
511 intelSetFrontClipRects( intel
);
515 GLboolean
intelUnbindContext(__DRIcontextPrivate
*driContextPriv
)
520 GLboolean
intelMakeCurrent(__DRIcontextPrivate
*driContextPriv
,
521 __DRIdrawablePrivate
*driDrawPriv
,
522 __DRIdrawablePrivate
*driReadPriv
)
525 if (driContextPriv
) {
526 intelContextPtr intel
= (intelContextPtr
) driContextPriv
->driverPrivate
;
528 if ( intel
->driDrawable
!= driDrawPriv
) {
529 /* Shouldn't the readbuffer be stored also? */
530 intel
->driDrawable
= driDrawPriv
;
531 intelWindowMoved( intel
);
534 _mesa_make_current2(&intel
->ctx
,
535 (GLframebuffer
*) driDrawPriv
->driverPrivate
,
536 (GLframebuffer
*) driReadPriv
->driverPrivate
);
538 if (!intel
->ctx
.Viewport
.Width
)
539 _mesa_set_viewport(&intel
->ctx
, 0, 0, driDrawPriv
->w
, driDrawPriv
->h
);
541 _mesa_make_current(0,0);
547 void intelGetLock( intelContextPtr intel
, GLuint flags
)
549 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
550 __DRIscreenPrivate
*sPriv
= intel
->driScreen
;
551 drmI830Sarea
* sarea
= intel
->sarea
;
552 int me
= intel
->hHWContext
;
555 drmGetLock(intel
->driFd
, intel
->hHWContext
, flags
);
557 /* If the window moved, may need to set a new cliprect now.
559 * NOTE: This releases and regains the hw lock, so all state
560 * checking must be done *after* this call:
563 DRI_VALIDATE_DRAWABLE_INFO(sPriv
, dPriv
);
565 /* If we lost context, need to dump all registers to hardware.
566 * Note that we don't care about 2d contexts, even if they perform
567 * accelerated commands, so the DRI locking in the X server is even
568 * more broken than usual.
571 if (sarea
->ctxOwner
!= me
) {
572 intel
->perf_boxes
|= I830_BOX_LOST_CONTEXT
;
573 sarea
->ctxOwner
= me
;
576 /* Shared texture managment - if another client has played with
577 * texture space, figure out which if any of our textures have been
578 * ejected, and update our global LRU.
581 for ( i
= 0 ; i
< intel
->nr_heaps
; i
++ ) {
582 DRI_AGE_TEXTURES( intel
->texture_heaps
[ i
] );
585 if (dPriv
&& intel
->lastStamp
!= dPriv
->lastStamp
) {
586 intelWindowMoved( intel
);
587 intel
->lastStamp
= dPriv
->lastStamp
;
591 void intelSwapBuffers( __DRIdrawablePrivate
*dPriv
)
593 if (dPriv
->driContextPriv
&& dPriv
->driContextPriv
->driverPrivate
) {
594 intelContextPtr intel
;
596 intel
= (intelContextPtr
) dPriv
->driContextPriv
->driverPrivate
;
598 if (ctx
->Visual
.doubleBufferMode
) {
599 _mesa_notifySwapBuffers( ctx
); /* flush pending rendering comands */
600 if ( 0 /*intel->doPageFlip*/ ) { /* doPageFlip is never set !!! */
601 intelPageFlip( dPriv
);
603 intelCopyBuffer( dPriv
);
607 /* XXX this shouldn't be an error but we can't handle it for now */
608 fprintf(stderr
, "%s: drawable has no context!\n", __FUNCTION__
);
613 void intelInitState( GLcontext
*ctx
)
615 /* Mesa should do this for us:
617 ctx
->Driver
.AlphaFunc( ctx
,
618 ctx
->Color
.AlphaFunc
,
619 ctx
->Color
.AlphaRef
);
621 ctx
->Driver
.BlendColor( ctx
,
622 ctx
->Color
.BlendColor
);
624 ctx
->Driver
.BlendEquationSeparate( ctx
,
625 ctx
->Color
.BlendEquationRGB
,
626 ctx
->Color
.BlendEquationA
);
628 ctx
->Driver
.BlendFuncSeparate( ctx
,
629 ctx
->Color
.BlendSrcRGB
,
630 ctx
->Color
.BlendDstRGB
,
631 ctx
->Color
.BlendSrcA
,
632 ctx
->Color
.BlendDstA
);
634 ctx
->Driver
.ColorMask( ctx
,
635 ctx
->Color
.ColorMask
[RCOMP
],
636 ctx
->Color
.ColorMask
[GCOMP
],
637 ctx
->Color
.ColorMask
[BCOMP
],
638 ctx
->Color
.ColorMask
[ACOMP
]);
640 ctx
->Driver
.CullFace( ctx
, ctx
->Polygon
.CullFaceMode
);
641 ctx
->Driver
.DepthFunc( ctx
, ctx
->Depth
.Func
);
642 ctx
->Driver
.DepthMask( ctx
, ctx
->Depth
.Mask
);
644 ctx
->Driver
.Enable( ctx
, GL_ALPHA_TEST
, ctx
->Color
.AlphaEnabled
);
645 ctx
->Driver
.Enable( ctx
, GL_BLEND
, ctx
->Color
.BlendEnabled
);
646 ctx
->Driver
.Enable( ctx
, GL_COLOR_LOGIC_OP
, ctx
->Color
.ColorLogicOpEnabled
);
647 ctx
->Driver
.Enable( ctx
, GL_COLOR_SUM
, ctx
->Fog
.ColorSumEnabled
);
648 ctx
->Driver
.Enable( ctx
, GL_CULL_FACE
, ctx
->Polygon
.CullFlag
);
649 ctx
->Driver
.Enable( ctx
, GL_DEPTH_TEST
, ctx
->Depth
.Test
);
650 ctx
->Driver
.Enable( ctx
, GL_DITHER
, ctx
->Color
.DitherFlag
);
651 ctx
->Driver
.Enable( ctx
, GL_FOG
, ctx
->Fog
.Enabled
);
652 ctx
->Driver
.Enable( ctx
, GL_LIGHTING
, ctx
->Light
.Enabled
);
653 ctx
->Driver
.Enable( ctx
, GL_LINE_SMOOTH
, ctx
->Line
.SmoothFlag
);
654 ctx
->Driver
.Enable( ctx
, GL_POLYGON_STIPPLE
, ctx
->Polygon
.StippleFlag
);
655 ctx
->Driver
.Enable( ctx
, GL_SCISSOR_TEST
, ctx
->Scissor
.Enabled
);
656 ctx
->Driver
.Enable( ctx
, GL_STENCIL_TEST
, ctx
->Stencil
.Enabled
);
657 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_1D
, GL_FALSE
);
658 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_2D
, GL_FALSE
);
659 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_RECTANGLE_NV
, GL_FALSE
);
660 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_3D
, GL_FALSE
);
661 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_CUBE_MAP
, GL_FALSE
);
663 ctx
->Driver
.Fogfv( ctx
, GL_FOG_COLOR
, ctx
->Fog
.Color
);
664 ctx
->Driver
.Fogfv( ctx
, GL_FOG_MODE
, 0 );
665 ctx
->Driver
.Fogfv( ctx
, GL_FOG_DENSITY
, &ctx
->Fog
.Density
);
666 ctx
->Driver
.Fogfv( ctx
, GL_FOG_START
, &ctx
->Fog
.Start
);
667 ctx
->Driver
.Fogfv( ctx
, GL_FOG_END
, &ctx
->Fog
.End
);
669 ctx
->Driver
.FrontFace( ctx
, ctx
->Polygon
.FrontFace
);
672 GLfloat f
= (GLfloat
)ctx
->Light
.Model
.ColorControl
;
673 ctx
->Driver
.LightModelfv( ctx
, GL_LIGHT_MODEL_COLOR_CONTROL
, &f
);
676 ctx
->Driver
.LineWidth( ctx
, ctx
->Line
.Width
);
677 ctx
->Driver
.LogicOpcode( ctx
, ctx
->Color
.LogicOp
);
678 ctx
->Driver
.PointSize( ctx
, ctx
->Point
.Size
);
679 ctx
->Driver
.PolygonStipple( ctx
, (const GLubyte
*)ctx
->PolygonStipple
);
680 ctx
->Driver
.Scissor( ctx
, ctx
->Scissor
.X
, ctx
->Scissor
.Y
,
681 ctx
->Scissor
.Width
, ctx
->Scissor
.Height
);
682 ctx
->Driver
.ShadeModel( ctx
, ctx
->Light
.ShadeModel
);
683 ctx
->Driver
.StencilFunc( ctx
,
684 ctx
->Stencil
.Function
[0],
686 ctx
->Stencil
.ValueMask
[0] );
687 ctx
->Driver
.StencilMask( ctx
, ctx
->Stencil
.WriteMask
[0] );
688 ctx
->Driver
.StencilOp( ctx
,
689 ctx
->Stencil
.FailFunc
[0],
690 ctx
->Stencil
.ZFailFunc
[0],
691 ctx
->Stencil
.ZPassFunc
[0]);
694 ctx
->Driver
.DrawBuffer( ctx
, ctx
->Color
.DrawBuffer
[0] );