1 /**************************************************************************
3 Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
4 Copyright 2003 Eric Anholt
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the "Software"),
9 to deal in the Software without restriction, including without limitation
10 on the rights to use, copy, modify, merge, publish, distribute, sub
11 license, and/or sell copies of the Software, and to permit persons to whom
12 the Software is furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice (including the next
15 paragraph) shall be included in all copies or substantial portions of the
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
22 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Sung-Ching Lin <sclin@sis.com.tw>
31 * Eric Anholt <anholt@FreeBSD.org>
34 #include "sis_context.h"
35 #include "sis_state.h"
39 #include "main/context.h"
40 #include "main/macros.h"
41 #include "main/state.h"
42 #include "swrast/swrast.h"
45 #include "swrast_setup/swrast_setup.h"
48 /* =============================================================
53 sisDDAlphaFunc( struct gl_context * ctx, GLenum func, GLfloat ref )
55 sisContextPtr smesa = SIS_CONTEXT(ctx);
58 __GLSiSHardware *prev = &smesa->prev;
59 __GLSiSHardware *current = &smesa->current;
61 CLAMPED_FLOAT_TO_UBYTE(refbyte, ref);
62 current->hwAlpha = refbyte << 16;
64 /* Alpha Test function */
68 current->hwAlpha |= SiS_ALPHA_NEVER;
71 current->hwAlpha |= SiS_ALPHA_LESS;
74 current->hwAlpha |= SiS_ALPHA_EQUAL;
77 current->hwAlpha |= SiS_ALPHA_LEQUAL;
80 current->hwAlpha |= SiS_ALPHA_GREATER;
83 current->hwAlpha |= SiS_ALPHA_NOTEQUAL;
86 current->hwAlpha |= SiS_ALPHA_GEQUAL;
89 current->hwAlpha |= SiS_ALPHA_ALWAYS;
93 prev->hwAlpha = current->hwAlpha;
94 smesa->GlobalFlag |= GFLAG_ALPHASETTING;
98 sisDDBlendFuncSeparate( struct gl_context *ctx,
99 GLenum sfactorRGB, GLenum dfactorRGB,
100 GLenum sfactorA, GLenum dfactorA )
102 sisContextPtr smesa = SIS_CONTEXT(ctx);
104 __GLSiSHardware *prev = &smesa->prev;
105 __GLSiSHardware *current = &smesa->current;
107 current->hwDstSrcBlend = 0;
112 current->hwDstSrcBlend |= SiS_D_ZERO;
115 current->hwDstSrcBlend |= SiS_D_ONE;
118 current->hwDstSrcBlend |= SiS_D_SRC_COLOR;
120 case GL_ONE_MINUS_SRC_COLOR:
121 current->hwDstSrcBlend |= SiS_D_ONE_MINUS_SRC_COLOR;
124 current->hwDstSrcBlend |= SiS_D_SRC_ALPHA;
126 case GL_ONE_MINUS_SRC_ALPHA:
127 current->hwDstSrcBlend |= SiS_D_ONE_MINUS_SRC_ALPHA;
130 current->hwDstSrcBlend |= SiS_D_DST_COLOR;
132 case GL_ONE_MINUS_DST_COLOR:
133 current->hwDstSrcBlend |= SiS_D_ONE_MINUS_DST_COLOR;
136 current->hwDstSrcBlend |= SiS_D_DST_ALPHA;
138 case GL_ONE_MINUS_DST_ALPHA:
139 current->hwDstSrcBlend |= SiS_D_ONE_MINUS_DST_ALPHA;
142 fprintf(stderr, "Unknown dst blend function 0x%x\n", dfactorRGB);
149 current->hwDstSrcBlend |= SiS_S_ZERO;
152 current->hwDstSrcBlend |= SiS_S_ONE;
155 current->hwDstSrcBlend |= SiS_S_SRC_COLOR;
157 case GL_ONE_MINUS_SRC_COLOR:
158 current->hwDstSrcBlend |= SiS_S_ONE_MINUS_SRC_COLOR;
161 current->hwDstSrcBlend |= SiS_S_SRC_ALPHA;
163 case GL_ONE_MINUS_SRC_ALPHA:
164 current->hwDstSrcBlend |= SiS_S_ONE_MINUS_SRC_ALPHA;
167 current->hwDstSrcBlend |= SiS_S_DST_COLOR;
169 case GL_ONE_MINUS_DST_COLOR:
170 current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_COLOR;
173 current->hwDstSrcBlend |= SiS_S_DST_ALPHA;
175 case GL_ONE_MINUS_DST_ALPHA:
176 current->hwDstSrcBlend |= SiS_S_ONE_MINUS_DST_ALPHA;
178 case GL_SRC_ALPHA_SATURATE:
179 current->hwDstSrcBlend |= SiS_S_SRC_ALPHA_SATURATE;
182 fprintf(stderr, "Unknown src blend function 0x%x\n", sfactorRGB);
186 if (current->hwDstSrcBlend != prev->hwDstSrcBlend) {
187 prev->hwDstSrcBlend = current->hwDstSrcBlend;
188 smesa->GlobalFlag |= GFLAG_DSTBLEND;
192 /* =============================================================
197 sisDDDepthFunc( struct gl_context * ctx, GLenum func )
199 sisContextPtr smesa = SIS_CONTEXT(ctx);
200 __GLSiSHardware *prev = &smesa->prev;
201 __GLSiSHardware *current = &smesa->current;
203 current->hwZ &= ~MASK_ZTestMode;
207 current->hwZ |= SiS_Z_COMP_S_LT_B;
210 current->hwZ |= SiS_Z_COMP_S_GE_B;
213 current->hwZ |= SiS_Z_COMP_S_LE_B;
216 current->hwZ |= SiS_Z_COMP_S_GT_B;
219 current->hwZ |= SiS_Z_COMP_S_NE_B;
222 current->hwZ |= SiS_Z_COMP_S_EQ_B;
225 current->hwZ |= SiS_Z_COMP_ALWAYS;
228 current->hwZ |= SiS_Z_COMP_NEVER;
232 if (current->hwZ != prev->hwZ) {
233 prev->hwZ = current->hwZ;
234 smesa->GlobalFlag |= GFLAG_ZSETTING;
239 sisDDDepthMask( struct gl_context * ctx, GLboolean flag )
241 sisContextPtr smesa = SIS_CONTEXT(ctx);
242 __GLSiSHardware *prev = &smesa->prev;
243 __GLSiSHardware *current = &smesa->current;
245 if (!ctx->Depth.Test)
248 if (ctx->Visual.stencilBits) {
249 if (flag || (ctx->Stencil.WriteMask[0] != 0)) {
250 current->hwCapEnable |= MASK_ZWriteEnable;
251 if (flag && ((ctx->Stencil.WriteMask[0] & 0xff) == 0xff)) {
252 current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable;
254 current->hwCapEnable2 |= MASK_ZMaskWriteEnable;
255 current->hwZMask = (ctx->Stencil.WriteMask[0] << 24) |
256 ((flag) ? 0x00ffffff : 0);
258 if (current->hwZMask ^ prev->hwZMask) {
259 prev->hwZMask = current->hwZMask;
260 smesa->GlobalFlag |= GFLAG_ZSETTING;
264 current->hwCapEnable &= ~MASK_ZWriteEnable;
268 current->hwCapEnable |= MASK_ZWriteEnable;
269 current->hwCapEnable2 &= ~MASK_ZMaskWriteEnable;
271 current->hwCapEnable &= ~MASK_ZWriteEnable;
276 /* =============================================================
281 sisUpdateClipping( struct gl_context *ctx )
283 sisContextPtr smesa = SIS_CONTEXT(ctx);
285 __GLSiSHardware *prev = &smesa->prev;
286 __GLSiSHardware *current = &smesa->current;
288 GLint x1, y1, x2, y2;
291 /* XXX: 6326 has its own clipping for now. Should be fixed */
292 sis6326UpdateClipping(ctx);
298 x2 = smesa->width - 1;
299 y2 = smesa->height - 1;
301 if (ctx->Scissor.Enabled) {
302 if (ctx->Scissor.X > x1)
304 if (ctx->Scissor.Y > y1)
306 if (ctx->Scissor.X + ctx->Scissor.Width - 1 < x2)
307 x2 = ctx->Scissor.X + ctx->Scissor.Width - 1;
308 if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < y2)
309 y2 = ctx->Scissor.Y + ctx->Scissor.Height - 1;
315 current->clipTopBottom = (y2 << 13) | y1;
316 current->clipLeftRight = (x1 << 13) | x2;
318 if ((current->clipTopBottom ^ prev->clipTopBottom) ||
319 (current->clipLeftRight ^ prev->clipLeftRight))
321 prev->clipTopBottom = current->clipTopBottom;
322 prev->clipLeftRight = current->clipLeftRight;
323 smesa->GlobalFlag |= GFLAG_CLIPPING;
328 sisDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
330 if (ctx->Scissor.Enabled)
331 sisUpdateClipping( ctx );
334 /* =============================================================
339 sisUpdateCull( struct gl_context *ctx )
341 sisContextPtr smesa = SIS_CONTEXT(ctx);
342 GLint cullflag, frontface;
344 cullflag = ctx->Polygon.CullFaceMode;
345 frontface = ctx->Polygon.FrontFace;
347 smesa->AGPParseSet &= ~(MASK_PsCullDirection_CCW);
348 smesa->dwPrimitiveSet &= ~(MASK_CullDirection);
350 if((cullflag == GL_FRONT && frontface == GL_CCW) ||
351 (cullflag == GL_BACK && frontface == GL_CW))
353 smesa->AGPParseSet |= MASK_PsCullDirection_CCW;
354 smesa->dwPrimitiveSet |= OP_3D_CullDirection_CCW;
360 sisDDCullFace( struct gl_context *ctx, GLenum mode )
362 sisUpdateCull( ctx );
366 sisDDFrontFace( struct gl_context *ctx, GLenum mode )
368 sisUpdateCull( ctx );
371 /* =============================================================
375 static void sisDDColorMask( struct gl_context *ctx,
376 GLboolean r, GLboolean g,
377 GLboolean b, GLboolean a )
379 sisContextPtr smesa = SIS_CONTEXT(ctx);
380 __GLSiSHardware *prev = &smesa->prev;
381 __GLSiSHardware *current = &smesa->current;
383 if (r && g && b && ((ctx->Visual.alphaBits == 0) || a)) {
384 current->hwCapEnable2 &= ~(MASK_AlphaMaskWriteEnable |
385 MASK_ColorMaskWriteEnable);
387 current->hwCapEnable2 |= (MASK_AlphaMaskWriteEnable |
388 MASK_ColorMaskWriteEnable);
390 current->hwDstMask = (r) ? smesa->redMask : 0 |
391 (g) ? smesa->greenMask : 0 |
392 (b) ? smesa->blueMask : 0 |
393 (a) ? smesa->alphaMask : 0;
396 if (current->hwDstMask != prev->hwDstMask) {
397 prev->hwDstMask = current->hwDstMask;
398 smesa->GlobalFlag |= GFLAG_DESTSETTING;
402 /* =============================================================
403 * Rendering attributes
406 static void sisUpdateSpecular(struct gl_context *ctx)
408 sisContextPtr smesa = SIS_CONTEXT(ctx);
409 __GLSiSHardware *current = &smesa->current;
411 if (_mesa_need_secondary_color(ctx))
412 current->hwCapEnable |= MASK_SpecularEnable;
414 current->hwCapEnable &= ~MASK_SpecularEnable;
417 static void sisDDLightModelfv(struct gl_context *ctx, GLenum pname,
418 const GLfloat *param)
420 if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
421 sisUpdateSpecular(ctx);
425 static void sisDDShadeModel( struct gl_context *ctx, GLenum mode )
427 sisContextPtr smesa = SIS_CONTEXT(ctx);
429 /* Signal to sisRasterPrimitive to recalculate dwPrimitiveSet */
430 smesa->hw_primitive = -1;
433 /* =============================================================
437 /* =============================================================
441 static void sisCalcViewport( struct gl_context *ctx )
443 sisContextPtr smesa = SIS_CONTEXT(ctx);
444 const GLfloat *v = ctx->Viewport._WindowMap.m;
445 GLfloat *m = smesa->hw_viewport;
447 /* See also sis_translate_vertex.
449 m[MAT_SX] = v[MAT_SX];
450 m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X;
451 m[MAT_SY] = - v[MAT_SY];
452 m[MAT_TY] = - v[MAT_TY] + smesa->driDrawable->h + SUBPIXEL_Y;
453 m[MAT_SZ] = v[MAT_SZ] * smesa->depth_scale;
454 m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale;
457 static void sisDDViewport( struct gl_context *ctx,
459 GLsizei width, GLsizei height )
461 sisCalcViewport( ctx );
464 static void sisDDDepthRange( struct gl_context *ctx,
465 GLclampd nearval, GLclampd farval )
467 sisCalcViewport( ctx );
470 /* =============================================================
475 sisDDLogicOpCode( struct gl_context *ctx, GLenum opcode )
477 sisContextPtr smesa = SIS_CONTEXT(ctx);
479 __GLSiSHardware *prev = &smesa->prev;
480 __GLSiSHardware *current = &smesa->current;
482 current->hwDstSet &= ~MASK_ROP2;
486 current->hwDstSet |= LOP_CLEAR;
489 current->hwDstSet |= LOP_SET;
492 current->hwDstSet |= LOP_COPY;
494 case GL_COPY_INVERTED:
495 current->hwDstSet |= LOP_COPY_INVERTED;
498 current->hwDstSet |= LOP_NOOP;
501 current->hwDstSet |= LOP_INVERT;
504 current->hwDstSet |= LOP_AND;
507 current->hwDstSet |= LOP_NAND;
510 current->hwDstSet |= LOP_OR;
513 current->hwDstSet |= LOP_NOR;
516 current->hwDstSet |= LOP_XOR;
519 current->hwDstSet |= LOP_EQUIV;
522 current->hwDstSet |= LOP_AND_REVERSE;
524 case GL_AND_INVERTED:
525 current->hwDstSet |= LOP_AND_INVERTED;
528 current->hwDstSet |= LOP_OR_REVERSE;
531 current->hwDstSet |= LOP_OR_INVERTED;
535 if (current->hwDstSet ^ prev->hwDstSet) {
536 prev->hwDstSet = current->hwDstSet;
537 smesa->GlobalFlag |= GFLAG_DESTSETTING;
541 void sisDDDrawBuffer( struct gl_context *ctx, GLenum mode )
543 sisContextPtr smesa = SIS_CONTEXT(ctx);
544 __GLSiSHardware *prev = &smesa->prev;
545 __GLSiSHardware *current = &smesa->current;
547 if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
548 FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_TRUE );
552 current->hwDstSet &= ~MASK_DstBufferPitch;
553 switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
554 case BUFFER_FRONT_LEFT:
555 FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
556 current->hwOffsetDest = smesa->front.offset >> 1;
557 current->hwDstSet |= smesa->front.pitch >> 2;
559 case BUFFER_BACK_LEFT:
560 FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_FALSE );
561 current->hwOffsetDest = smesa->back.offset >> 1;
562 current->hwDstSet |= smesa->back.pitch >> 2;
565 FALLBACK( smesa, SIS_FALLBACK_DRAW_BUFFER, GL_TRUE );
569 if (current->hwDstSet != prev->hwDstSet) {
570 prev->hwDstSet = current->hwDstSet;
571 smesa->GlobalFlag |= GFLAG_DESTSETTING;
574 if (current->hwOffsetDest != prev->hwOffsetDest) {
575 prev->hwOffsetDest = current->hwOffsetDest;
576 smesa->GlobalFlag |= GFLAG_DESTSETTING;
580 /* =============================================================
584 /* =============================================================
588 /* =============================================================
589 * State enable/disable
593 sisDDEnable( struct gl_context * ctx, GLenum cap, GLboolean state )
595 sisContextPtr smesa = SIS_CONTEXT(ctx);
597 __GLSiSHardware *current = &smesa->current;
603 current->hwCapEnable |= MASK_AlphaTestEnable;
605 current->hwCapEnable &= ~MASK_AlphaTestEnable;
610 /* if (state & !ctx->Color.ColorLogicOpEnabled) */
611 current->hwCapEnable |= MASK_BlendEnable;
613 current->hwCapEnable &= ~MASK_BlendEnable;
617 current->hwCapEnable |= MASK_CullEnable;
619 current->hwCapEnable &= ~MASK_CullEnable;
622 if (state && smesa->depth.offset != 0)
623 current->hwCapEnable |= MASK_ZTestEnable;
625 current->hwCapEnable &= ~MASK_ZTestEnable;
626 sisDDDepthMask( ctx, ctx->Depth.Mask );
630 current->hwCapEnable |= MASK_DitherEnable;
632 current->hwCapEnable &= ~MASK_DitherEnable;
636 current->hwCapEnable |= MASK_FogEnable;
638 current->hwCapEnable &= ~MASK_FogEnable;
640 case GL_COLOR_LOGIC_OP:
642 sisDDLogicOpCode( ctx, ctx->Color.LogicOp );
644 sisDDLogicOpCode( ctx, GL_COPY );
646 case GL_SCISSOR_TEST:
647 sisUpdateClipping( ctx );
649 case GL_STENCIL_TEST:
651 if (smesa->zFormat != SiS_ZFORMAT_S8Z24)
652 FALLBACK(smesa, SIS_FALLBACK_STENCIL, 1);
654 current->hwCapEnable |= (MASK_StencilTestEnable |
655 MASK_StencilWriteEnable);
657 FALLBACK(smesa, SIS_FALLBACK_STENCIL, 0);
658 current->hwCapEnable &= ~(MASK_StencilTestEnable |
659 MASK_StencilWriteEnable);
663 case GL_COLOR_SUM_EXT:
664 sisUpdateSpecular(ctx);
670 /* =============================================================
671 * State initialization, management
674 /* Called before beginning of rendering. */
676 sisUpdateHWState( struct gl_context *ctx )
678 sisContextPtr smesa = SIS_CONTEXT(ctx);
679 __GLSiSHardware *prev = &smesa->prev;
680 __GLSiSHardware *current = &smesa->current;
682 /* enable setting 1 */
683 if (current->hwCapEnable ^ prev->hwCapEnable) {
684 prev->hwCapEnable = current->hwCapEnable;
685 smesa->GlobalFlag |= GFLAG_ENABLESETTING;
688 /* enable setting 2 */
689 if (current->hwCapEnable2 ^ prev->hwCapEnable2) {
690 prev->hwCapEnable2 = current->hwCapEnable2;
691 smesa->GlobalFlag |= GFLAG_ENABLESETTING2;
694 if (smesa->GlobalFlag & GFLAG_RENDER_STATES)
695 sis_update_render_state( smesa );
697 if (smesa->GlobalFlag & GFLAG_TEXTURE_STATES)
698 sis_update_texture_state( smesa );
702 sisDDInvalidateState( struct gl_context *ctx, GLuint new_state )
704 sisContextPtr smesa = SIS_CONTEXT(ctx);
706 _swrast_InvalidateState( ctx, new_state );
707 _swsetup_InvalidateState( ctx, new_state );
708 _vbo_InvalidateState( ctx, new_state );
709 _tnl_InvalidateState( ctx, new_state );
710 smesa->NewGLState |= new_state;
713 /* Initialize the context's hardware state.
715 void sisDDInitState( sisContextPtr smesa )
717 __GLSiSHardware *current = &smesa->current;
718 __GLSiSHardware *prev = &(smesa->prev);
719 struct gl_context *ctx = smesa->glCtx;
721 /* add Texture Perspective Enable */
722 prev->hwCapEnable = MASK_FogPerspectiveEnable | MASK_TextureCacheEnable |
723 MASK_TexturePerspectiveEnable | MASK_DitherEnable;
726 prev->hwCapEnable2 = 0x00aa0080;
728 /* if multi-texture enabled, disable Z pre-test */
729 prev->hwCapEnable2 = MASK_TextureMipmapBiasEnable;
731 /* Z test mode is LESS */
732 prev->hwZ = SiS_Z_COMP_S_LT_B;
735 prev->hwZMask = 0xffffffff;
737 /* Alpha test mode is ALWAYS, alpha ref value is 0 */
738 prev->hwAlpha = SiS_ALPHA_ALWAYS;
740 /* ROP2 is COPYPEN */
741 prev->hwDstSet = LOP_COPY;
744 prev->hwDstMask = 0xffffffff;
746 /* LinePattern is 0, Repeat Factor is 0 */
747 prev->hwLinePattern = 0x00008000;
749 /* Src blend is BLEND_ONE, Dst blend is D3DBLEND_ZERO */
750 prev->hwDstSrcBlend = SiS_S_ONE | SiS_D_ZERO;
752 /* Stenciling disabled, function ALWAYS, ref value zero, mask all ones */
753 prev->hwStSetting = STENCIL_FORMAT_8 | SiS_STENCIL_ALWAYS | 0xff;
754 /* Op is KEEP for all three operations */
755 prev->hwStSetting2 = SiS_SFAIL_KEEP | SiS_SPASS_ZFAIL_KEEP |
756 SiS_SPASS_ZPASS_KEEP;
758 /* Texture mapping mode is Tile */
760 prev->texture[0].hwTextureSet = 0x00030000;
762 /* Magnified & minified texture filter is NEAREST */
764 prev->texture[0].hwTextureMip = 0;
767 /* Texture Blending setting -- use fragment color/alpha*/
768 prev->hwTexBlendColor0 = STAGE0_C_CF;
769 prev->hwTexBlendColor1 = STAGE1_C_CF;
770 prev->hwTexBlendAlpha0 = STAGE0_A_AF;
771 prev->hwTexBlendAlpha1 = STAGE1_A_AF;
773 switch (smesa->bytesPerPixel)
776 prev->hwDstSet |= DST_FORMAT_RGB_565;
779 prev->hwDstSet |= DST_FORMAT_ARGB_8888;
783 switch (ctx->Visual.depthBits)
786 prev->hwCapEnable &= ~MASK_ZWriteEnable;
788 smesa->zFormat = SiS_ZFORMAT_Z16;
789 prev->hwCapEnable |= MASK_ZWriteEnable;
790 smesa->depth_scale = 1.0 / (GLfloat)0xffff;
793 smesa->zFormat = SiS_ZFORMAT_Z32;
794 prev->hwCapEnable |= MASK_ZWriteEnable;
795 smesa->depth_scale = 1.0 / (GLfloat)0xffffffff;
798 assert (ctx->Visual.stencilBits);
799 smesa->zFormat = SiS_ZFORMAT_S8Z24;
800 prev->hwCapEnable |= MASK_StencilBufferEnable;
801 prev->hwCapEnable |= MASK_ZWriteEnable;
802 smesa->depth_scale = 1.0 / (GLfloat)0xffffff;
806 prev->hwZ |= smesa->zFormat;
808 /* TODO: need to clear cache? */
809 smesa->clearTexCache = GL_TRUE;
811 smesa->clearColorPattern = 0;
813 smesa->AGPParseSet = MASK_PsTexture1FromB | MASK_PsBumpTextureFromC;
814 smesa->dwPrimitiveSet = OP_3D_Texture1FromB | OP_3D_TextureBumpFromC;
816 sisUpdateZStencilPattern( smesa, 1.0, 0 );
817 sisUpdateCull( ctx );
819 memcpy( current, prev, sizeof (__GLSiSHardware) );
821 /* Set initial fog settings. Start and end are the same case. */
822 sisDDFogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
823 sisDDFogfv( ctx, GL_FOG_END, &ctx->Fog.End );
824 sisDDFogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL );
825 sisDDFogfv( ctx, GL_FOG_MODE, NULL );
828 /* Initialize the driver's state functions.
830 void sisDDInitStateFuncs( struct gl_context *ctx )
832 ctx->Driver.UpdateState = sisDDInvalidateState;
834 ctx->Driver.Clear = sisDDClear;
835 ctx->Driver.ClearColor = sisDDClearColor;
836 ctx->Driver.ClearDepth = sisDDClearDepth;
837 ctx->Driver.ClearStencil = sisDDClearStencil;
839 ctx->Driver.AlphaFunc = sisDDAlphaFunc;
840 ctx->Driver.BlendFuncSeparate = sisDDBlendFuncSeparate;
841 ctx->Driver.ColorMask = sisDDColorMask;
842 ctx->Driver.CullFace = sisDDCullFace;
843 ctx->Driver.DepthMask = sisDDDepthMask;
844 ctx->Driver.DepthFunc = sisDDDepthFunc;
845 ctx->Driver.DepthRange = sisDDDepthRange;
846 ctx->Driver.DrawBuffer = sisDDDrawBuffer;
847 ctx->Driver.Enable = sisDDEnable;
848 ctx->Driver.FrontFace = sisDDFrontFace;
849 ctx->Driver.Fogfv = sisDDFogfv;
850 ctx->Driver.Hint = NULL;
851 ctx->Driver.Lightfv = NULL;
852 ctx->Driver.LogicOpcode = sisDDLogicOpCode;
853 ctx->Driver.PolygonMode = NULL;
854 ctx->Driver.PolygonStipple = NULL;
855 ctx->Driver.ReadBuffer = NULL;
856 ctx->Driver.RenderMode = NULL;
857 ctx->Driver.Scissor = sisDDScissor;
858 ctx->Driver.ShadeModel = sisDDShadeModel;
859 ctx->Driver.LightModelfv = sisDDLightModelfv;
860 ctx->Driver.Viewport = sisDDViewport;
862 /* XXX this should go away */
863 ctx->Driver.ResizeBuffers = sisReAllocateBuffers;