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"
34 #include "framebuffer.h"
37 #include "swrast/swrast.h"
38 #include "swrast_setup/swrast_setup.h"
40 #include "array_cache/acache.h"
42 #include "tnl/t_pipeline.h"
43 #include "tnl/t_vertex.h"
45 #include "drivers/common/driverfuncs.h"
47 #include "intel_screen.h"
50 #include "i830_common.h"
52 #include "intel_tex.h"
53 #include "intel_span.h"
54 #include "intel_tris.h"
55 #include "intel_ioctl.h"
56 #include "intel_batchbuffer.h"
60 int INTEL_DEBUG
= (0);
63 #define need_GL_ARB_multisample
64 #define need_GL_ARB_point_parameters
65 #define need_GL_ARB_texture_compression
66 #define need_GL_ARB_vertex_buffer_object
67 #define need_GL_ARB_vertex_program
68 #define need_GL_ARB_window_pos
69 #define need_GL_EXT_blend_color
70 #define need_GL_EXT_blend_equation_separate
71 #define need_GL_EXT_blend_func_separate
72 #define need_GL_EXT_blend_minmax
73 #define need_GL_EXT_cull_vertex
74 #define need_GL_EXT_fog_coord
75 #define need_GL_EXT_multi_draw_arrays
76 #define need_GL_EXT_secondary_color
77 #define need_GL_NV_vertex_program
78 #include "extension_helper.h"
89 /***************************************
90 * Mesa's Driver Functions
91 ***************************************/
93 #define DRIVER_DATE "20050225"
95 const GLubyte
*intelGetString( GLcontext
*ctx
, GLenum name
)
98 static char buffer
[128];
102 return (GLubyte
*)"Tungsten Graphics, Inc";
106 switch (INTEL_CONTEXT(ctx
)->intelScreen
->deviceID
) {
108 chipset
= "Intel(R) 845G"; break;
109 case PCI_CHIP_I830_M
:
110 chipset
= "Intel(R) 830M"; break;
111 case PCI_CHIP_I855_GM
:
112 chipset
= "Intel(R) 852GM/855GM"; break;
113 case PCI_CHIP_I865_G
:
114 chipset
= "Intel(R) 865G"; break;
115 case PCI_CHIP_I915_G
:
116 chipset
= "Intel(R) 915G"; break;
117 case PCI_CHIP_I915_GM
:
118 chipset
= "Intel(R) 915GM"; break;
119 case PCI_CHIP_I945_G
:
120 chipset
= "Intel(R) 945G"; break;
122 chipset
= "Unknown Intel Chipset"; break;
125 (void) driGetRendererString( buffer
, chipset
, DRIVER_DATE
, 0 );
126 return (GLubyte
*) buffer
;
133 static void intelBufferSize(GLframebuffer
*buffer
,
134 GLuint
*width
, GLuint
*height
)
136 GET_CURRENT_CONTEXT(ctx
);
137 intelContextPtr intel
= INTEL_CONTEXT(ctx
);
138 /* Need to lock to make sure the driDrawable is uptodate. This
139 * information is used to resize Mesa's software buffers, so it has
142 LOCK_HARDWARE(intel
);
143 *width
= intel
->driDrawable
->w
;
144 *height
= intel
->driDrawable
->h
;
145 UNLOCK_HARDWARE(intel
);
150 * Extension strings exported by the intel driver.
153 * It appears that ARB_texture_env_crossbar has "disappeared" compared to the
154 * old i830-specific driver.
156 const struct dri_extension card_extensions
[] =
158 { "GL_ARB_multisample", GL_ARB_multisample_functions
},
159 { "GL_ARB_multitexture", NULL
},
160 { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions
},
161 { "GL_ARB_texture_border_clamp", NULL
},
162 { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions
},
163 { "GL_ARB_texture_cube_map", NULL
},
164 { "GL_ARB_texture_env_add", NULL
},
165 { "GL_ARB_texture_env_combine", NULL
},
166 { "GL_ARB_texture_env_dot3", NULL
},
167 { "GL_ARB_texture_mirrored_repeat", NULL
},
168 { "GL_ARB_texture_rectangle", NULL
},
169 { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions
},
170 { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions
},
171 { "GL_ARB_window_pos", GL_ARB_window_pos_functions
},
172 { "GL_EXT_blend_color", GL_EXT_blend_color_functions
},
173 { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions
},
174 { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions
},
175 { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions
},
176 { "GL_EXT_blend_subtract", NULL
},
177 { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions
},
178 { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions
},
179 { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions
},
180 { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions
},
181 { "GL_EXT_stencil_wrap", NULL
},
182 { "GL_EXT_texture_edge_clamp", NULL
},
183 { "GL_EXT_texture_env_combine", NULL
},
184 { "GL_EXT_texture_env_dot3", NULL
},
185 { "GL_EXT_texture_filter_anisotropic", NULL
},
186 { "GL_EXT_texture_lod_bias", NULL
},
187 { "GL_3DFX_texture_compression_FXT1", NULL
},
188 { "GL_APPLE_client_storage", NULL
},
189 { "GL_MESA_pack_invert", NULL
},
190 { "GL_MESA_ycbcr_texture", NULL
},
191 { "GL_NV_blend_square", NULL
},
192 { "GL_NV_vertex_program", GL_NV_vertex_program_functions
},
193 { "GL_NV_vertex_program1_1", NULL
},
194 { "GL_SGIS_generate_mipmap", NULL
},
198 extern const struct tnl_pipeline_stage _intel_render_stage
;
200 static const struct tnl_pipeline_stage
*intel_pipeline
[] = {
201 &_tnl_vertex_transform_stage
,
202 &_tnl_vertex_cull_stage
,
203 &_tnl_normal_transform_stage
,
204 &_tnl_lighting_stage
,
205 &_tnl_fog_coordinate_stage
,
207 &_tnl_texture_transform_stage
,
208 &_tnl_point_attenuation_stage
,
209 &_tnl_arb_vertex_program_stage
,
210 &_tnl_vertex_program_stage
,
212 &_intel_render_stage
, /* ADD: unclipped rastersetup-to-dma */
219 static const struct dri_debug_control debug_control
[] =
221 { "fall", DEBUG_FALLBACKS
},
222 { "tex", DEBUG_TEXTURE
},
223 { "ioctl", DEBUG_IOCTL
},
224 { "prim", DEBUG_PRIMS
},
225 { "vert", DEBUG_VERTS
},
226 { "state", DEBUG_STATE
},
227 { "verb", DEBUG_VERBOSE
},
228 { "dri", DEBUG_DRI
},
229 { "dma", DEBUG_DMA
},
230 { "san", DEBUG_SANITY
},
231 { "sync", DEBUG_SYNC
},
232 { "sleep", DEBUG_SLEEP
},
233 { "pix", DEBUG_PIXEL
},
238 static void intelInvalidateState( GLcontext
*ctx
, GLuint new_state
)
240 _swrast_InvalidateState( ctx
, new_state
);
241 _swsetup_InvalidateState( ctx
, new_state
);
242 _ac_InvalidateState( ctx
, new_state
);
243 _tnl_InvalidateState( ctx
, new_state
);
244 _tnl_invalidate_vertex_state( ctx
, new_state
);
245 INTEL_CONTEXT(ctx
)->NewGLState
|= new_state
;
249 void intelInitDriverFunctions( struct dd_function_table
*functions
)
251 _mesa_init_driver_functions( functions
);
253 functions
->Flush
= intelFlush
;
254 functions
->Clear
= intelClear
;
255 functions
->Finish
= intelFinish
;
256 functions
->GetBufferSize
= intelBufferSize
;
257 functions
->ResizeBuffers
= _mesa_resize_framebuffer
;
258 functions
->GetString
= intelGetString
;
259 functions
->UpdateState
= intelInvalidateState
;
260 functions
->CopyColorTable
= _swrast_CopyColorTable
;
261 functions
->CopyColorSubTable
= _swrast_CopyColorSubTable
;
262 functions
->CopyConvolutionFilter1D
= _swrast_CopyConvolutionFilter1D
;
263 functions
->CopyConvolutionFilter2D
= _swrast_CopyConvolutionFilter2D
;
265 intelInitTextureFuncs( functions
);
266 intelInitPixelFuncs( functions
);
267 intelInitStateFuncs( functions
);
272 GLboolean
intelInitContext( intelContextPtr intel
,
273 const __GLcontextModes
*mesaVis
,
274 __DRIcontextPrivate
*driContextPriv
,
275 void *sharedContextPrivate
,
276 struct dd_function_table
*functions
)
278 GLcontext
*ctx
= &intel
->ctx
;
279 GLcontext
*shareCtx
= (GLcontext
*) sharedContextPrivate
;
280 __DRIscreenPrivate
*sPriv
= driContextPriv
->driScreenPriv
;
281 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
282 drmI830Sarea
*saPriv
= (drmI830Sarea
*)
283 (((GLubyte
*)sPriv
->pSAREA
)+intelScreen
->sarea_priv_offset
);
285 if (!_mesa_initialize_context(&intel
->ctx
,
291 driContextPriv
->driverPrivate
= intel
;
292 intel
->intelScreen
= intelScreen
;
293 intel
->driScreen
= sPriv
;
294 intel
->sarea
= saPriv
;
297 (void) memset( intel
->texture_heaps
, 0, sizeof( intel
->texture_heaps
) );
298 make_empty_list( & intel
->swapped
);
300 ctx
->Const
.MaxTextureMaxAnisotropy
= 2.0;
302 ctx
->Const
.MinLineWidth
= 1.0;
303 ctx
->Const
.MinLineWidthAA
= 1.0;
304 ctx
->Const
.MaxLineWidth
= 3.0;
305 ctx
->Const
.MaxLineWidthAA
= 3.0;
306 ctx
->Const
.LineWidthGranularity
= 1.0;
308 ctx
->Const
.MinPointSize
= 1.0;
309 ctx
->Const
.MinPointSizeAA
= 1.0;
310 ctx
->Const
.MaxPointSize
= 255.0;
311 ctx
->Const
.MaxPointSizeAA
= 3.0;
312 ctx
->Const
.PointSizeGranularity
= 1.0;
314 /* Initialize the software rasterizer and helper modules. */
315 _swrast_CreateContext( ctx
);
316 _ac_CreateContext( ctx
);
317 _tnl_CreateContext( ctx
);
318 _swsetup_CreateContext( ctx
);
320 /* Install the customized pipeline: */
321 _tnl_destroy_pipeline( ctx
);
322 _tnl_install_pipeline( ctx
, intel_pipeline
);
324 /* Configure swrast to match hardware characteristics: */
325 _swrast_allow_pixel_fog( ctx
, GL_FALSE
);
326 _swrast_allow_vertex_fog( ctx
, GL_TRUE
);
329 intel
->hHWContext
= driContextPriv
->hHWContext
;
330 intel
->driFd
= sPriv
->fd
;
331 intel
->driHwLock
= (drmLock
*) &sPriv
->pSAREA
->lock
;
333 intel
->hw_stencil
= mesaVis
->stencilBits
&& mesaVis
->depthBits
== 24;
334 intel
->hw_stipple
= 1;
336 switch(mesaVis
->depthBits
) {
337 case 0: /* what to do in this case? */
339 intel
->depth_scale
= 1.0/0xffff;
340 intel
->polygon_offset_scale
= 1.0/0xffff;
341 intel
->depth_clear_mask
= ~0;
342 intel
->ClearDepth
= 0xffff;
345 intel
->depth_scale
= 1.0/0xffffff;
346 intel
->polygon_offset_scale
= 2.0/0xffffff; /* req'd to pass glean */
347 intel
->depth_clear_mask
= 0x00ffffff;
348 intel
->stencil_clear_mask
= 0xff000000;
349 intel
->ClearDepth
= 0x00ffffff;
356 /* Initialize swrast, tnl driver tables: */
357 intelInitSpanFuncs( ctx
);
358 intelInitTriFuncs( ctx
);
361 intel
->RenderIndex
= ~0;
363 intel
->do_irqs
= (intel
->intelScreen
->irq_active
&&
364 !getenv("INTEL_NO_IRQS"));
366 _math_matrix_ctr (&intel
->ViewportMatrix
);
368 driInitExtensions( ctx
, card_extensions
, GL_TRUE
);
370 if (intel
->ctx
.Mesa_DXTn
) {
371 _mesa_enable_extension( ctx
, "GL_EXT_texture_compression_s3tc" );
372 _mesa_enable_extension( ctx
, "GL_S3_s3tc" );
374 else if (driQueryOptionb (&intelScreen
->optionCache
, "force_s3tc_enable")) {
375 _mesa_enable_extension( ctx
, "GL_EXT_texture_compression_s3tc" );
378 /* driInitTextureObjects( ctx, & intel->swapped, */
379 /* DRI_TEXMGR_DO_TEXTURE_1D | */
380 /* DRI_TEXMGR_DO_TEXTURE_2D | */
381 /* DRI_TEXMGR_DO_TEXTURE_RECT ); */
384 intel
->prim
.flush
= intelInitBatchBuffer
;
385 intel
->prim
.primitive
= ~0;
389 INTEL_DEBUG
= driParseDebugString( getenv( "INTEL_DEBUG" ),
391 INTEL_DEBUG
|= driParseDebugString( getenv( "INTEL_DEBUG" ),
396 if (getenv("INTEL_VERBOSE"))
400 if (getenv("INTEL_NO_RAST") ||
401 getenv("INTEL_NO_RAST")) {
402 fprintf(stderr
, "disabling 3D rasterization\n");
403 FALLBACK(intel
, INTEL_FALLBACK_USER
, 1);
409 void intelDestroyContext(__DRIcontextPrivate
*driContextPriv
)
411 intelContextPtr intel
= (intelContextPtr
) driContextPriv
->driverPrivate
;
413 assert(intel
); /* should never be null */
415 GLboolean release_texture_heaps
;
418 intel
->vtbl
.destroy( intel
);
420 release_texture_heaps
= (intel
->ctx
.Shared
->RefCount
== 1);
421 _swsetup_DestroyContext (&intel
->ctx
);
422 _tnl_DestroyContext (&intel
->ctx
);
423 _ac_DestroyContext (&intel
->ctx
);
425 _swrast_DestroyContext (&intel
->ctx
);
426 intel
->Fallback
= 0; /* don't call _swrast_Flush later */
428 intelDestroyBatchBuffer(&intel
->ctx
);
431 if ( release_texture_heaps
) {
432 /* This share group is about to go away, free our private
433 * texture object data.
437 for ( i
= 0 ; i
< intel
->nr_heaps
; i
++ ) {
438 driDestroyTextureHeap( intel
->texture_heaps
[ i
] );
439 intel
->texture_heaps
[ i
] = NULL
;
442 assert( is_empty_list( & intel
->swapped
) );
445 /* free the Mesa context */
446 _mesa_destroy_context(&intel
->ctx
);
450 void intelSetFrontClipRects( intelContextPtr intel
)
452 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
456 intel
->numClipRects
= dPriv
->numClipRects
;
457 intel
->pClipRects
= dPriv
->pClipRects
;
458 intel
->drawX
= dPriv
->x
;
459 intel
->drawY
= dPriv
->y
;
463 void intelSetBackClipRects( intelContextPtr intel
)
465 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
469 if (intel
->sarea
->pf_enabled
== 0 && dPriv
->numBackClipRects
== 0) {
470 intel
->numClipRects
= dPriv
->numClipRects
;
471 intel
->pClipRects
= dPriv
->pClipRects
;
472 intel
->drawX
= dPriv
->x
;
473 intel
->drawY
= dPriv
->y
;
475 intel
->numClipRects
= dPriv
->numBackClipRects
;
476 intel
->pClipRects
= dPriv
->pBackClipRects
;
477 intel
->drawX
= dPriv
->backX
;
478 intel
->drawY
= dPriv
->backY
;
480 if (dPriv
->numBackClipRects
== 1 &&
481 dPriv
->x
== dPriv
->backX
&&
482 dPriv
->y
== dPriv
->backY
) {
484 /* Repeat the calculation of the back cliprect dimensions here
485 * as early versions of dri.a in the Xserver are incorrect. Try
486 * very hard not to restrict future versions of dri.a which
487 * might eg. allocate truly private back buffers.
494 x2
= dPriv
->x
+ dPriv
->w
;
495 y2
= dPriv
->y
+ dPriv
->h
;
499 if (x2
> intel
->intelScreen
->width
) x2
= intel
->intelScreen
->width
;
500 if (y2
> intel
->intelScreen
->height
) y2
= intel
->intelScreen
->height
;
502 if (x1
== dPriv
->pBackClipRects
[0].x1
&&
503 y1
== dPriv
->pBackClipRects
[0].y1
) {
505 dPriv
->pBackClipRects
[0].x2
= x2
;
506 dPriv
->pBackClipRects
[0].y2
= y2
;
513 void intelWindowMoved( intelContextPtr intel
)
515 if (!intel
->ctx
.DrawBuffer
) {
516 intelSetFrontClipRects( intel
);
519 switch (intel
->ctx
.DrawBuffer
->_ColorDrawBufferMask
[0]) {
520 case BUFFER_BIT_FRONT_LEFT
:
521 intelSetFrontClipRects( intel
);
523 case BUFFER_BIT_BACK_LEFT
:
524 intelSetBackClipRects( intel
);
527 /* glDrawBuffer(GL_NONE or GL_FRONT_AND_BACK): software fallback */
528 intelSetFrontClipRects( intel
);
533 GLboolean
intelUnbindContext(__DRIcontextPrivate
*driContextPriv
)
538 GLboolean
intelMakeCurrent(__DRIcontextPrivate
*driContextPriv
,
539 __DRIdrawablePrivate
*driDrawPriv
,
540 __DRIdrawablePrivate
*driReadPriv
)
543 if (driContextPriv
) {
544 intelContextPtr intel
= (intelContextPtr
) driContextPriv
->driverPrivate
;
546 if ( intel
->driDrawable
!= driDrawPriv
) {
547 /* Shouldn't the readbuffer be stored also? */
548 intel
->driDrawable
= driDrawPriv
;
549 intelWindowMoved( intel
);
552 _mesa_make_current(&intel
->ctx
,
553 (GLframebuffer
*) driDrawPriv
->driverPrivate
,
554 (GLframebuffer
*) driReadPriv
->driverPrivate
);
556 intel
->ctx
.Driver
.DrawBuffer( &intel
->ctx
, intel
->ctx
.Color
.DrawBuffer
[0] );
558 _mesa_make_current(NULL
, NULL
, NULL
);
564 void intelGetLock( intelContextPtr intel
, GLuint flags
)
566 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
567 __DRIscreenPrivate
*sPriv
= intel
->driScreen
;
568 drmI830Sarea
* sarea
= intel
->sarea
;
569 int me
= intel
->hHWContext
;
572 drmGetLock(intel
->driFd
, intel
->hHWContext
, flags
);
574 /* If the window moved, may need to set a new cliprect now.
576 * NOTE: This releases and regains the hw lock, so all state
577 * checking must be done *after* this call:
580 DRI_VALIDATE_DRAWABLE_INFO(sPriv
, dPriv
);
582 /* If we lost context, need to dump all registers to hardware.
583 * Note that we don't care about 2d contexts, even if they perform
584 * accelerated commands, so the DRI locking in the X server is even
585 * more broken than usual.
588 if (sarea
->ctxOwner
!= me
) {
589 intel
->perf_boxes
|= I830_BOX_LOST_CONTEXT
;
590 sarea
->ctxOwner
= me
;
593 /* Shared texture managment - if another client has played with
594 * texture space, figure out which if any of our textures have been
595 * ejected, and update our global LRU.
598 for ( i
= 0 ; i
< intel
->nr_heaps
; i
++ ) {
599 DRI_AGE_TEXTURES( intel
->texture_heaps
[ i
] );
602 if (dPriv
&& intel
->lastStamp
!= dPriv
->lastStamp
) {
603 intelWindowMoved( intel
);
604 intel
->lastStamp
= dPriv
->lastStamp
;
608 void intelSwapBuffers( __DRIdrawablePrivate
*dPriv
)
610 if (dPriv
->driContextPriv
&& dPriv
->driContextPriv
->driverPrivate
) {
611 intelContextPtr intel
;
613 intel
= (intelContextPtr
) dPriv
->driContextPriv
->driverPrivate
;
615 if (ctx
->Visual
.doubleBufferMode
) {
616 _mesa_notifySwapBuffers( ctx
); /* flush pending rendering comands */
617 if ( 0 /*intel->doPageFlip*/ ) { /* doPageFlip is never set !!! */
618 intelPageFlip( dPriv
);
620 intelCopyBuffer( dPriv
);
624 /* XXX this shouldn't be an error but we can't handle it for now */
625 fprintf(stderr
, "%s: drawable has no context!\n", __FUNCTION__
);
630 void intelInitState( GLcontext
*ctx
)
632 /* Mesa should do this for us:
634 ctx
->Driver
.AlphaFunc( ctx
,
635 ctx
->Color
.AlphaFunc
,
636 ctx
->Color
.AlphaRef
);
638 ctx
->Driver
.BlendColor( ctx
,
639 ctx
->Color
.BlendColor
);
641 ctx
->Driver
.BlendEquationSeparate( ctx
,
642 ctx
->Color
.BlendEquationRGB
,
643 ctx
->Color
.BlendEquationA
);
645 ctx
->Driver
.BlendFuncSeparate( ctx
,
646 ctx
->Color
.BlendSrcRGB
,
647 ctx
->Color
.BlendDstRGB
,
648 ctx
->Color
.BlendSrcA
,
649 ctx
->Color
.BlendDstA
);
651 ctx
->Driver
.ColorMask( ctx
,
652 ctx
->Color
.ColorMask
[RCOMP
],
653 ctx
->Color
.ColorMask
[GCOMP
],
654 ctx
->Color
.ColorMask
[BCOMP
],
655 ctx
->Color
.ColorMask
[ACOMP
]);
657 ctx
->Driver
.CullFace( ctx
, ctx
->Polygon
.CullFaceMode
);
658 ctx
->Driver
.DepthFunc( ctx
, ctx
->Depth
.Func
);
659 ctx
->Driver
.DepthMask( ctx
, ctx
->Depth
.Mask
);
661 ctx
->Driver
.Enable( ctx
, GL_ALPHA_TEST
, ctx
->Color
.AlphaEnabled
);
662 ctx
->Driver
.Enable( ctx
, GL_BLEND
, ctx
->Color
.BlendEnabled
);
663 ctx
->Driver
.Enable( ctx
, GL_COLOR_LOGIC_OP
, ctx
->Color
.ColorLogicOpEnabled
);
664 ctx
->Driver
.Enable( ctx
, GL_COLOR_SUM
, ctx
->Fog
.ColorSumEnabled
);
665 ctx
->Driver
.Enable( ctx
, GL_CULL_FACE
, ctx
->Polygon
.CullFlag
);
666 ctx
->Driver
.Enable( ctx
, GL_DEPTH_TEST
, ctx
->Depth
.Test
);
667 ctx
->Driver
.Enable( ctx
, GL_DITHER
, ctx
->Color
.DitherFlag
);
668 ctx
->Driver
.Enable( ctx
, GL_FOG
, ctx
->Fog
.Enabled
);
669 ctx
->Driver
.Enable( ctx
, GL_LIGHTING
, ctx
->Light
.Enabled
);
670 ctx
->Driver
.Enable( ctx
, GL_LINE_SMOOTH
, ctx
->Line
.SmoothFlag
);
671 ctx
->Driver
.Enable( ctx
, GL_POLYGON_STIPPLE
, ctx
->Polygon
.StippleFlag
);
672 ctx
->Driver
.Enable( ctx
, GL_SCISSOR_TEST
, ctx
->Scissor
.Enabled
);
673 ctx
->Driver
.Enable( ctx
, GL_STENCIL_TEST
, ctx
->Stencil
.Enabled
);
674 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_1D
, GL_FALSE
);
675 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_2D
, GL_FALSE
);
676 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_RECTANGLE_NV
, GL_FALSE
);
677 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_3D
, GL_FALSE
);
678 ctx
->Driver
.Enable( ctx
, GL_TEXTURE_CUBE_MAP
, GL_FALSE
);
680 ctx
->Driver
.Fogfv( ctx
, GL_FOG_COLOR
, ctx
->Fog
.Color
);
681 ctx
->Driver
.Fogfv( ctx
, GL_FOG_MODE
, 0 );
682 ctx
->Driver
.Fogfv( ctx
, GL_FOG_DENSITY
, &ctx
->Fog
.Density
);
683 ctx
->Driver
.Fogfv( ctx
, GL_FOG_START
, &ctx
->Fog
.Start
);
684 ctx
->Driver
.Fogfv( ctx
, GL_FOG_END
, &ctx
->Fog
.End
);
686 ctx
->Driver
.FrontFace( ctx
, ctx
->Polygon
.FrontFace
);
689 GLfloat f
= (GLfloat
)ctx
->Light
.Model
.ColorControl
;
690 ctx
->Driver
.LightModelfv( ctx
, GL_LIGHT_MODEL_COLOR_CONTROL
, &f
);
693 ctx
->Driver
.LineWidth( ctx
, ctx
->Line
.Width
);
694 ctx
->Driver
.LogicOpcode( ctx
, ctx
->Color
.LogicOp
);
695 ctx
->Driver
.PointSize( ctx
, ctx
->Point
.Size
);
696 ctx
->Driver
.PolygonStipple( ctx
, (const GLubyte
*)ctx
->PolygonStipple
);
697 ctx
->Driver
.Scissor( ctx
, ctx
->Scissor
.X
, ctx
->Scissor
.Y
,
698 ctx
->Scissor
.Width
, ctx
->Scissor
.Height
);
699 ctx
->Driver
.ShadeModel( ctx
, ctx
->Light
.ShadeModel
);
700 ctx
->Driver
.StencilFuncSeparate( ctx
, GL_FRONT
,
701 ctx
->Stencil
.Function
[0],
703 ctx
->Stencil
.ValueMask
[0] );
704 ctx
->Driver
.StencilFuncSeparate( ctx
, GL_BACK
,
705 ctx
->Stencil
.Function
[1],
707 ctx
->Stencil
.ValueMask
[1] );
708 ctx
->Driver
.StencilMaskSeparate( ctx
, GL_FRONT
, ctx
->Stencil
.WriteMask
[0] );
709 ctx
->Driver
.StencilMaskSeparate( ctx
, GL_BACK
, ctx
->Stencil
.WriteMask
[1] );
710 ctx
->Driver
.StencilOpSeparate( ctx
, GL_FRONT
,
711 ctx
->Stencil
.FailFunc
[0],
712 ctx
->Stencil
.ZFailFunc
[0],
713 ctx
->Stencil
.ZPassFunc
[0]);
714 ctx
->Driver
.StencilOpSeparate( ctx
, GL_BACK
,
715 ctx
->Stencil
.FailFunc
[1],
716 ctx
->Stencil
.ZFailFunc
[1],
717 ctx
->Stencil
.ZPassFunc
[1]);
720 ctx
->Driver
.DrawBuffer( ctx
, ctx
->Color
.DrawBuffer
[0] );