1 /* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_state.c,v 1.5 2002/11/05 17:46:07 tsi Exp $ */
3 * Copyright 2001 by Alan Hourihane.
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Alan Hourihane not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Alan Hourihane makes no representations
12 * about the suitability of this software for any purpose. It is provided
13 * "as is" without express or implied warranty.
15 * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
23 * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
28 #include "gamma_context.h"
29 #include "gamma_macros.h"
31 #include "glint_dri.h"
33 #include "swrast/swrast.h"
34 #include "swrast_setup/swrast_setup.h"
35 #include "array_cache/acache.h"
38 #define ENABLELIGHTING 0
40 /* =============================================================
44 static void gammaUpdateAlphaMode( GLcontext
*ctx
)
46 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
47 CARD32 a
= gmesa
->AlphaTestMode
;
48 CARD32 b
= gmesa
->AlphaBlendMode
;
49 CARD32 f
= gmesa
->AB_FBReadMode_Save
= 0;
50 GLubyte refByte
= (GLint
) (ctx
->Color
.AlphaRef
* 255.0);
52 a
&= ~(AT_CompareMask
| AT_RefValueMask
);
53 b
&= ~(AB_SrcBlendMask
| AB_DstBlendMask
);
57 switch ( ctx
->Color
.AlphaFunc
) {
84 if ( ctx
->Color
.AlphaEnabled
) {
86 a
|= AlphaTestModeEnable
;
88 a
&= ~AlphaTestModeEnable
;
91 switch ( ctx
->Color
.BlendSrcRGB
) {
101 case GL_ONE_MINUS_DST_COLOR
:
102 b
|= AB_Src_OneMinusDstColor
;
105 b
|= AB_Src_SrcAlpha
;
107 case GL_ONE_MINUS_SRC_ALPHA
:
108 b
|= AB_Src_OneMinusSrcAlpha
;
111 b
|= AB_Src_DstAlpha
;
112 f
|= FBReadSrcEnable
;
114 case GL_ONE_MINUS_DST_ALPHA
:
115 b
|= AB_Src_OneMinusDstAlpha
;
116 f
|= FBReadSrcEnable
;
118 case GL_SRC_ALPHA_SATURATE
:
119 b
|= AB_Src_SrcAlphaSaturate
;
123 switch ( ctx
->Color
.BlendDstRGB
) {
131 b
|= AB_Dst_SrcColor
;
133 case GL_ONE_MINUS_SRC_COLOR
:
134 b
|= AB_Dst_OneMinusSrcColor
;
137 b
|= AB_Dst_SrcAlpha
;
139 case GL_ONE_MINUS_SRC_ALPHA
:
140 b
|= AB_Dst_OneMinusSrcAlpha
;
143 b
|= AB_Dst_DstAlpha
;
144 f
|= FBReadSrcEnable
;
146 case GL_ONE_MINUS_DST_ALPHA
:
147 b
|= AB_Dst_OneMinusDstAlpha
;
148 f
|= FBReadSrcEnable
;
152 if ( ctx
->Color
.BlendEnabled
) {
153 f
|= FBReadDstEnable
;
154 b
|= AlphaBlendModeEnable
;
156 b
&= ~AlphaBlendModeEnable
;
159 if ( gmesa
->AlphaTestMode
!= a
) {
160 gmesa
->AlphaTestMode
= a
;
161 gmesa
->dirty
|= GAMMA_UPLOAD_ALPHA
;
163 if ( gmesa
->AlphaBlendMode
!= b
) {
164 gmesa
->AlphaBlendMode
= b
;
165 gmesa
->dirty
|= GAMMA_UPLOAD_BLEND
;
167 gmesa
->AB_FBReadMode_Save
= f
;
170 static void gammaDDAlphaFunc( GLcontext
*ctx
, GLenum func
, GLfloat ref
)
172 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
175 FLUSH_BATCH( gmesa
);
177 gmesa
->new_state
|= GAMMA_NEW_ALPHA
;
180 static void gammaDDBlendEquation( GLcontext
*ctx
, GLenum mode
)
182 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
184 FLUSH_BATCH( gmesa
);
186 gmesa
->new_state
|= GAMMA_NEW_ALPHA
;
189 static void gammaDDBlendFunc( GLcontext
*ctx
, GLenum sfactor
, GLenum dfactor
)
191 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
193 FLUSH_BATCH( gmesa
);
195 gmesa
->new_state
|= GAMMA_NEW_ALPHA
;
198 static void gammaDDBlendFuncSeparate( GLcontext
*ctx
,
199 GLenum sfactorRGB
, GLenum dfactorRGB
,
200 GLenum sfactorA
, GLenum dfactorA
)
202 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
204 FLUSH_BATCH( gmesa
);
206 gmesa
->new_state
|= GAMMA_NEW_ALPHA
;
210 /* ================================================================
214 static void gammaDDClear( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
215 GLint cx
, GLint cy
, GLint cw
, GLint ch
)
217 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
218 GLINTDRIPtr gDRIPriv
= (GLINTDRIPtr
)gmesa
->driScreen
->pDevPriv
;
221 FLUSH_BATCH( gmesa
);
223 /* Update and emit any new state. We need to do this here to catch
224 * changes to the masks.
225 * FIXME: Just update the masks?
227 if ( gmesa
->new_state
)
228 gammaDDUpdateHWState( ctx
);
231 /* Flush any partially filled buffers */
232 FLUSH_DMA_BUFFER(gmesa
);
234 DRM_SPINLOCK(&gmesa
->driScreen
->pSAREA
->drawable_lock
,
235 gmesa
->driScreen
->drawLockID
);
236 VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa
);
239 if (mask
& DD_DEPTH_BIT
) {
240 /* Turn off writes the FB */
241 CHECK_DMA_BUFFER(gmesa
, 1);
242 WRITE(gmesa
->buf
, FBWriteMode
, FBWriteModeDisable
);
244 mask
&= ~DD_DEPTH_BIT
;
247 * Turn Rectangle2DControl off when the window is not clipped
248 * (i.e., the GID tests are not necessary). This dramatically
249 * increases the performance of the depth clears.
251 if (!gmesa
->NotClipped
) {
252 CHECK_DMA_BUFFER(gmesa
, 1);
253 WRITE(gmesa
->buf
, Rectangle2DControl
, 1);
256 temp
= (gmesa
->LBReadMode
& LBPartialProdMask
) | LBWindowOriginBot
;
257 if (gDRIPriv
->numMultiDevices
== 2) temp
|= LBScanLineInt2
;
259 CHECK_DMA_BUFFER(gmesa
, 5);
260 WRITE(gmesa
->buf
, LBReadMode
, temp
);
261 WRITE(gmesa
->buf
, DeltaMode
, DM_DepthEnable
);
262 WRITE(gmesa
->buf
, DepthMode
, (DepthModeEnable
|
264 DM_SourceDepthRegister
|
266 WRITE(gmesa
->buf
, GLINTDepth
, gmesa
->ClearDepth
);
268 /* Increment the frame count */
271 gmesa
->FrameCount
&= 0x0f;
273 gmesa
->FrameCount
&= 0xff;
276 /* Force FCP to be written */
277 WRITE(gmesa
->buf
, GLINTWindow
, (WindowEnable
|
279 (gmesa
->Window
& W_GIDMask
) |
281 W_LBUpdateFromRegisters
|
282 W_OverrideWriteFiltering
|
283 (gmesa
->FrameCount
<< 9)));
285 /* Clear part of the depth and FCP buffers */
287 int y
= gmesa
->driScreen
->fbHeight
- gmesa
->driDrawable
->y
- gmesa
->driDrawable
->h
;
288 int x
= gmesa
->driDrawable
->x
;
289 int w
= gmesa
->driDrawable
->w
;
290 int h
= gmesa
->driDrawable
->h
;
294 if (gmesa
->WindowChanged
) {
295 gmesa
->WindowChanged
= GL_FALSE
;
303 /* Handle the case where the height < # of FCPs */
305 if (gmesa
->FrameCount
> h
)
306 gmesa
->FrameCount
= 0;
308 y
+= gmesa
->FrameCount
;
310 h
= (gmesa
->FrameCount
+1)*hsub
;
311 h
-= (int)(gmesa
->FrameCount
*hsub
);
312 y
+= gmesa
->FrameCount
*hsub
;
318 CHECK_DMA_BUFFER(gmesa
, 2);
319 WRITE(gmesa
->buf
, Rectangle2DMode
, ((h
& 0xfff)<<12) |
321 WRITE(gmesa
->buf
, DrawRectangle2D
, ((y
& 0xffff)<<16) |
324 CHECK_DMA_BUFFER(gmesa
, 8);
325 WRITE(gmesa
->buf
, StartXDom
, x
<<16);
326 WRITE(gmesa
->buf
, StartY
, y
<<16);
327 WRITE(gmesa
->buf
, StartXSub
, (x
+w
)<<16);
328 WRITE(gmesa
->buf
, GLINTCount
, h
);
329 WRITE(gmesa
->buf
, dY
, 1<<16);
330 WRITE(gmesa
->buf
, dXDom
, 0<<16);
331 WRITE(gmesa
->buf
, dXSub
, 0<<16);
332 WRITE(gmesa
->buf
, Render
, 0x00000040); /* NOT_DONE */
337 CHECK_DMA_BUFFER(gmesa
, 6);
338 WRITE(gmesa
->buf
, DepthMode
, gmesa
->DepthMode
);
339 WRITE(gmesa
->buf
, DeltaMode
, gmesa
->DeltaMode
);
340 WRITE(gmesa
->buf
, LBReadMode
, gmesa
->LBReadMode
);
341 WRITE(gmesa
->buf
, GLINTWindow
, gmesa
->Window
);
342 WRITE(gmesa
->buf
, FastClearDepth
, gmesa
->ClearDepth
);
343 WRITE(gmesa
->buf
, FBWriteMode
, FBWriteModeEnable
);
345 /* Turn on Depth FCP */
346 if (gmesa
->Window
& W_DepthFCP
) {
347 CHECK_DMA_BUFFER(gmesa
, 1);
348 WRITE(gmesa
->buf
, WindowOr
, (gmesa
->FrameCount
<< 9));
351 /* Turn off GID clipping if window is not clipped */
352 if (gmesa
->NotClipped
) {
353 CHECK_DMA_BUFFER(gmesa
, 1);
354 WRITE(gmesa
->buf
, Rectangle2DControl
, 0);
358 if (mask
& (DD_FRONT_LEFT_BIT
| DD_BACK_LEFT_BIT
)) {
359 int y
= gmesa
->driScreen
->fbHeight
- gmesa
->driDrawable
->y
- gmesa
->driDrawable
->h
;
360 int x
= gmesa
->driDrawable
->x
;
361 int w
= gmesa
->driDrawable
->w
;
362 int h
= gmesa
->driDrawable
->h
;
364 mask
&= ~(DD_FRONT_LEFT_BIT
| DD_BACK_LEFT_BIT
);
366 if (x
< 0) { w
-= -x
; x
= 0; }
368 /* Turn on GID clipping if window is clipped */
369 if (!gmesa
->NotClipped
) {
370 CHECK_DMA_BUFFER(gmesa
, 1);
371 WRITE(gmesa
->buf
, Rectangle2DControl
, 1);
374 CHECK_DMA_BUFFER(gmesa
, 18);
375 WRITE(gmesa
->buf
, FBBlockColor
, gmesa
->ClearColor
);
376 WRITE(gmesa
->buf
, ColorDDAMode
, ColorDDADisable
);
377 WRITE(gmesa
->buf
, FBWriteMode
, FBWriteModeEnable
);
378 WRITE(gmesa
->buf
, DepthMode
, 0);
379 WRITE(gmesa
->buf
, DeltaMode
, 0);
380 WRITE(gmesa
->buf
, AlphaBlendMode
, 0);
382 WRITE(gmesa
->buf
, dY
, 1<<16);
383 WRITE(gmesa
->buf
, dXDom
, 0<<16);
384 WRITE(gmesa
->buf
, dXSub
, 0<<16);
385 WRITE(gmesa
->buf
, StartXSub
, (x
+w
)<<16);
386 WRITE(gmesa
->buf
, GLINTCount
, h
);
387 WRITE(gmesa
->buf
, StartXDom
, x
<<16);
388 WRITE(gmesa
->buf
, StartY
, y
<<16);
389 WRITE(gmesa
->buf
, Render
, 0x00000048); /* NOT_DONE */
391 WRITE(gmesa
->buf
, Rectangle2DMode
, (((h
& 0xfff)<<12) |
393 WRITE(gmesa
->buf
, DrawRectangle2D
, (((y
& 0xffff)<<16) |
396 WRITE(gmesa
->buf
, DepthMode
, gmesa
->DepthMode
);
397 WRITE(gmesa
->buf
, DeltaMode
, gmesa
->DeltaMode
);
398 WRITE(gmesa
->buf
, AlphaBlendMode
, gmesa
->AlphaBlendMode
);
399 WRITE(gmesa
->buf
, ColorDDAMode
, gmesa
->ColorDDAMode
);
401 /* Turn off GID clipping if window is clipped */
402 if (gmesa
->NotClipped
) {
403 CHECK_DMA_BUFFER(gmesa
, 1);
404 WRITE(gmesa
->buf
, Rectangle2DControl
, 0);
409 PROCESS_DMA_BUFFER_TOP_HALF(gmesa
);
411 DRM_SPINUNLOCK(&gmesa
->driScreen
->pSAREA
->drawable_lock
,
412 gmesa
->driScreen
->drawLockID
);
413 VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa
);
415 PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa
);
419 _swrast_Clear( ctx
, mask
, all
, cx
, cy
, cw
, ch
);
422 /* =============================================================
426 static void gammaUpdateZMode( GLcontext
*ctx
)
428 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
429 CARD32 z
= gmesa
->DepthMode
;
430 CARD32 delta
= gmesa
->DeltaMode
;
431 CARD32 window
= gmesa
->Window
;
432 CARD32 lbread
= gmesa
->LBReadMode
;
434 z
&= ~DM_CompareMask
;
436 switch ( ctx
->Depth
.Func
) {
453 z
|= DM_GreaterEqual
;
463 if ( ctx
->Depth
.Test
) {
464 z
|= DepthModeEnable
;
465 delta
|= DM_DepthEnable
;
466 window
|= W_DepthFCP
;
467 lbread
|= LBReadDstEnable
;
469 z
&= ~DepthModeEnable
;
470 delta
&= ~DM_DepthEnable
;
471 window
&= ~W_DepthFCP
;
472 lbread
&= ~LBReadDstEnable
;
475 if ( ctx
->Depth
.Mask
) {
482 if ( gmesa
->DepthMode
!= z
){
484 gmesa
->DepthMode
= z
;
485 gmesa
->DeltaMode
= delta
;
486 gmesa
->Window
= window
;
487 gmesa
->LBReadMode
= lbread
;
488 gmesa
->dirty
|= GAMMA_UPLOAD_DEPTH
;
494 static void gammaDDDepthFunc( GLcontext
*ctx
, GLenum func
)
496 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
498 FLUSH_BATCH( gmesa
);
499 gmesa
->new_state
|= GAMMA_NEW_DEPTH
;
502 static void gammaDDDepthMask( GLcontext
*ctx
, GLboolean flag
)
504 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
506 FLUSH_BATCH( gmesa
);
507 gmesa
->new_state
|= GAMMA_NEW_DEPTH
;
510 static void gammaDDClearDepth( GLcontext
*ctx
, GLclampd d
)
512 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
514 switch ( gmesa
->DepthSize
) {
516 gmesa
->ClearDepth
= d
* 0x0000ffff;
519 gmesa
->ClearDepth
= d
* 0x00ffffff;
522 gmesa
->ClearDepth
= d
* 0xffffffff;
527 static void gammaDDFinish( GLcontext
*ctx
)
529 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
531 FLUSH_DMA_BUFFER(gmesa
);
534 static void gammaDDFlush( GLcontext
*ctx
)
536 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
538 FLUSH_DMA_BUFFER(gmesa
);
541 /* =============================================================
545 static void gammaUpdateFogAttrib( GLcontext
*ctx
)
547 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
548 CARD32 f
= gmesa
->FogMode
;
549 CARD32 g
= gmesa
->GeometryMode
;
550 CARD32 d
= gmesa
->DeltaMode
;
552 if (ctx
->Fog
.Enabled
) {
564 switch (ctx
->Fog
.Mode
) {
572 g
|= GM_FogExpSquared
;
576 if ( gmesa
->FogMode
!= f
) {
578 gmesa
->dirty
|= GAMMA_UPLOAD_FOG
;
581 if ( gmesa
->GeometryMode
!= g
) {
582 gmesa
->GeometryMode
= g
;
583 gmesa
->dirty
|= GAMMA_UPLOAD_GEOMETRY
;
586 if ( gmesa
->DeltaMode
!= d
) {
587 gmesa
->DeltaMode
= d
;
588 gmesa
->dirty
|= GAMMA_UPLOAD_DEPTH
;
592 static void gammaDDFogfv( GLcontext
*ctx
, GLenum pname
, const GLfloat
*param
)
594 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
596 FLUSH_BATCH( gmesa
);
597 gmesa
->new_state
|= GAMMA_NEW_FOG
;
600 /* =============================================================
603 static void gammaDDLineWidth( GLcontext
*ctx
, GLfloat width
)
605 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
607 CHECK_DMA_BUFFER(gmesa
, 3);
608 WRITE(gmesa
->buf
, LineWidth
, (GLuint
)width
);
609 WRITEF(gmesa
->buf
, AAlineWidth
, width
);
610 WRITE(gmesa
->buf
, LineWidthOffset
, (GLuint
)(width
-1)/2);
613 static void gammaDDLineStipple( GLcontext
*ctx
, GLint factor
, GLushort pattern
)
615 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
617 gmesa
->LineMode
&= ~(LM_StippleMask
| LM_RepeatFactorMask
);
618 gmesa
->LineMode
|= ((GLuint
)(factor
- 1) << 1) | ((GLuint
)pattern
<< 10);
620 gmesa
->dirty
|= GAMMA_UPLOAD_LINEMODE
;
625 /* =============================================================
628 static void gammaDDPointSize( GLcontext
*ctx
, GLfloat size
)
630 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
632 CHECK_DMA_BUFFER(gmesa
, 2);
633 WRITE(gmesa
->buf
, PointSize
, (GLuint
)size
);
634 WRITEF(gmesa
->buf
, AApointSize
, size
);
637 /* =============================================================
641 static void gammaUpdatePolygon( GLcontext
*ctx
)
643 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
644 CARD32 g
= gmesa
->GeometryMode
;
646 g
&= ~(GM_PolyOffsetFillEnable
| GM_PolyOffsetPointEnable
|
647 GM_PolyOffsetLineEnable
);
649 if (ctx
->Polygon
.OffsetFill
) g
|= GM_PolyOffsetFillEnable
;
650 if (ctx
->Polygon
.OffsetPoint
) g
|= GM_PolyOffsetPointEnable
;
651 if (ctx
->Polygon
.OffsetLine
) g
|= GM_PolyOffsetLineEnable
;
653 g
&= ~GM_FB_PolyMask
;
655 switch (ctx
->Polygon
.FrontMode
) {
657 g
|= GM_FrontPolyFill
;
660 g
|= GM_FrontPolyLine
;
663 g
|= GM_FrontPolyPoint
;
667 switch (ctx
->Polygon
.BackMode
) {
669 g
|= GM_BackPolyFill
;
672 g
|= GM_BackPolyLine
;
675 g
|= GM_BackPolyPoint
;
679 if ( gmesa
->GeometryMode
!= g
) {
680 gmesa
->GeometryMode
= g
;
681 gmesa
->dirty
|= GAMMA_UPLOAD_GEOMETRY
;
684 gmesa
->dirty
|= GAMMA_UPLOAD_POLYGON
;
687 static void gammaDDPolygonMode( GLcontext
*ctx
, GLenum face
, GLenum mode
)
689 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
691 FLUSH_BATCH( gmesa
);
693 gmesa
->new_state
|= GAMMA_NEW_POLYGON
;
696 static void gammaUpdateStipple( GLcontext
*ctx
)
698 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
700 FLUSH_BATCH( gmesa
);
702 if (ctx
->Polygon
.StippleFlag
) {
703 gmesa
->AreaStippleMode
|= AreaStippleModeEnable
/* | ASM_X32 | ASM_Y32*/;
705 gmesa
->AreaStippleMode
&= ~AreaStippleModeEnable
;
708 gmesa
->dirty
|= GAMMA_UPLOAD_STIPPLE
;
711 static void gammaDDPolygonStipple( GLcontext
*ctx
, const GLubyte
*mask
)
713 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
714 FLUSH_BATCH( gmesa
);
715 gmesa
->new_state
|= GAMMA_NEW_STIPPLE
;
718 /* =============================================================
722 static void gammaUpdateClipping( GLcontext
*ctx
)
724 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
725 GLint x1
, y1
, x2
, y2
;
727 if ( gmesa
->driDrawable
) {
728 x1
= gmesa
->driDrawable
->x
+ ctx
->Scissor
.X
;
729 y1
= gmesa
->driScreen
->fbHeight
-
730 (gmesa
->driDrawable
->y
+
731 gmesa
->driDrawable
->h
) + ctx
->Scissor
.Y
;
732 x2
= x1
+ ctx
->Scissor
.Width
;
733 y2
= y1
+ ctx
->Scissor
.Height
;
735 gmesa
->ScissorMinXY
= x1
| (y1
<< 16);
736 gmesa
->ScissorMaxXY
= x2
| (y2
<< 16);
737 if (ctx
->Scissor
.Enabled
)
738 gmesa
->ScissorMode
|= UserScissorEnable
;
740 gmesa
->ScissorMode
&= ~UserScissorEnable
;
742 gmesa
->dirty
|= GAMMA_UPLOAD_CLIP
;
746 static void gammaDDScissor( GLcontext
*ctx
,
747 GLint x
, GLint y
, GLsizei w
, GLsizei h
)
749 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
751 FLUSH_BATCH( gmesa
);
752 gmesa
->new_state
|= GAMMA_NEW_CLIP
;
755 /* =============================================================
759 static void gammaUpdateCull( GLcontext
*ctx
)
761 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
762 CARD32 g
= gmesa
->GeometryMode
;
764 g
&= ~(GM_PolyCullMask
| GM_FFMask
);
766 if (ctx
->Polygon
.FrontFace
== GL_CCW
) {
767 g
|= GM_FrontFaceCCW
;
772 switch ( ctx
->Polygon
.CullFaceMode
) {
774 g
|= GM_PolyCullFront
;
777 g
|= GM_PolyCullBack
;
779 case GL_FRONT_AND_BACK
:
780 g
|= GM_PolyCullBoth
;
784 if ( ctx
->Polygon
.CullFlag
) {
785 g
|= GM_PolyCullEnable
;
787 g
&= ~GM_PolyCullEnable
;
790 if ( gmesa
->GeometryMode
!= g
) {
791 gmesa
->GeometryMode
= g
;
792 gmesa
->dirty
|= GAMMA_UPLOAD_GEOMETRY
;
796 static void gammaDDCullFace( GLcontext
*ctx
, GLenum mode
)
798 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
800 FLUSH_BATCH( gmesa
);
801 gmesa
->new_state
|= GAMMA_NEW_CULL
;
804 static void gammaDDFrontFace( GLcontext
*ctx
, GLenum mode
)
806 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
808 FLUSH_BATCH( gmesa
);
809 gmesa
->new_state
|= GAMMA_NEW_CULL
;
812 /* =============================================================
816 static void gammaUpdateMasks( GLcontext
*ctx
)
818 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
821 GLuint mask
= gammaPackColor( gmesa
->gammaScreen
->cpp
,
822 ctx
->Color
.ColorMask
[RCOMP
],
823 ctx
->Color
.ColorMask
[GCOMP
],
824 ctx
->Color
.ColorMask
[BCOMP
],
825 ctx
->Color
.ColorMask
[ACOMP
] );
827 if (gmesa
->gammaScreen
->cpp
== 2) mask
|= mask
<< 16;
829 if ( gmesa
->FBHardwareWriteMask
!= mask
) {
830 gmesa
->FBHardwareWriteMask
= mask
;
831 gmesa
->dirty
|= GAMMA_UPLOAD_MASKS
;
835 static void gammaDDColorMask( GLcontext
*ctx
, GLboolean r
, GLboolean g
,
836 GLboolean b
, GLboolean a
)
838 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
840 FLUSH_BATCH( gmesa
);
841 gmesa
->new_state
|= GAMMA_NEW_MASKS
;
844 /* =============================================================
845 * Rendering attributes
847 * We really don't want to recalculate all this every time we bind a
848 * texture. These things shouldn't change all that often, so it makes
849 * sense to break them out of the core texture state update routines.
853 static void gammaDDLightfv(GLcontext
*ctx
, GLenum light
, GLenum pname
,
854 const GLfloat
*params
, GLint nParams
)
856 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
863 CHECK_DMA_BUFFER(gmesa
, 3);
864 /* We don't do alpha */
865 WRITEF(gmesa
->buf
, Light0AmbientIntensityBlue
, params
[2]);
866 WRITEF(gmesa
->buf
, Light0AmbientIntensityGreen
, params
[1]);
867 WRITEF(gmesa
->buf
, Light0AmbientIntensityRed
, params
[0]);
870 CHECK_DMA_BUFFER(gmesa
, 3);
871 /* We don't do alpha */
872 WRITEF(gmesa
->buf
, Light0DiffuseIntensityBlue
, params
[2]);
873 WRITEF(gmesa
->buf
, Light0DiffuseIntensityGreen
, params
[1]);
874 WRITEF(gmesa
->buf
, Light0DiffuseIntensityRed
, params
[0]);
877 CHECK_DMA_BUFFER(gmesa
, 3);
878 /* We don't do alpha */
879 WRITEF(gmesa
->buf
, Light0SpecularIntensityBlue
, params
[2]);
880 WRITEF(gmesa
->buf
, Light0SpecularIntensityGreen
, params
[1]);
881 WRITEF(gmesa
->buf
, Light0SpecularIntensityRed
, params
[0]);
884 /* Normalize <x,y,z> */
885 x
= params
[0]; y
= params
[1]; z
= params
[2]; w
= params
[3];
886 l
= sqrt(x
*x
+ y
*y
+ z
*z
+ w
*w
);
891 if (params
[3] != 0.0) {
892 gmesa
->Light0Mode
|= Light0ModeAttenuation
;
893 gmesa
->Light0Mode
|= Light0ModeLocal
;
895 gmesa
->Light0Mode
&= ~Light0ModeAttenuation
;
896 gmesa
->Light0Mode
&= ~Light0ModeLocal
;
898 CHECK_DMA_BUFFER(gmesa
, 5);
899 WRITE(gmesa
->buf
, Light0Mode
, gmesa
->Light0Mode
);
900 WRITEF(gmesa
->buf
, Light0PositionW
, w
);
901 WRITEF(gmesa
->buf
, Light0PositionZ
, z
);
902 WRITEF(gmesa
->buf
, Light0PositionY
, y
);
903 WRITEF(gmesa
->buf
, Light0PositionX
, x
);
905 case GL_SPOT_DIRECTION
:
906 CHECK_DMA_BUFFER(gmesa
, 3);
907 /* WRITEF(gmesa->buf, Light0SpotlightDirectionW, params[3]); */
908 WRITEF(gmesa
->buf
, Light0SpotlightDirectionZ
, params
[2]);
909 WRITEF(gmesa
->buf
, Light0SpotlightDirectionY
, params
[1]);
910 WRITEF(gmesa
->buf
, Light0SpotlightDirectionX
, params
[0]);
912 case GL_SPOT_EXPONENT
:
913 CHECK_DMA_BUFFER(gmesa
, 1);
914 WRITEF(gmesa
->buf
, Light0SpotlightExponent
, params
[0]);
917 if (params
[0] != 180.0)
918 gmesa
->Light0Mode
|= Light0ModeSpotLight
;
920 gmesa
->Light0Mode
&= ~Light0ModeSpotLight
;
921 CHECK_DMA_BUFFER(gmesa
, 2);
922 WRITE(gmesa
->buf
, Light0Mode
, gmesa
->Light0Mode
);
923 WRITEF(gmesa
->buf
, Light0CosSpotlightCutoffAngle
, cos(params
[0]*DEG2RAD
));
925 case GL_CONSTANT_ATTENUATION
:
926 CHECK_DMA_BUFFER(gmesa
, 1);
927 WRITEF(gmesa
->buf
, Light0ConstantAttenuation
, params
[0]);
929 case GL_LINEAR_ATTENUATION
:
930 CHECK_DMA_BUFFER(gmesa
, 1);
931 WRITEF(gmesa
->buf
, Light0LinearAttenuation
, params
[0]);
933 case GL_QUADRATIC_ATTENUATION
:
934 CHECK_DMA_BUFFER(gmesa
, 1);
935 WRITEF(gmesa
->buf
, Light0QuadraticAttenuation
, params
[0]);
942 static void gammaDDLightModelfv( GLcontext
*ctx
, GLenum pname
,
943 const GLfloat
*params
)
945 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
948 case GL_LIGHT_MODEL_AMBIENT
:
949 CHECK_DMA_BUFFER(gmesa
, 3);
950 /* We don't do alpha */
951 WRITEF(gmesa
->buf
, SceneAmbientColorBlue
, params
[2]);
952 WRITEF(gmesa
->buf
, SceneAmbientColorGreen
, params
[1]);
953 WRITEF(gmesa
->buf
, SceneAmbientColorRed
, params
[0]);
955 case GL_LIGHT_MODEL_LOCAL_VIEWER
:
956 if (params
[0] != 0.0)
957 gmesa
->LightingMode
|= LightingModeLocalViewer
;
959 gmesa
->LightingMode
&= ~LightingModeLocalViewer
;
960 CHECK_DMA_BUFFER(gmesa
, 1);
961 WRITE(gmesa
->buf
, LightingMode
, gmesa
->LightingMode
);
963 case GL_LIGHT_MODEL_TWO_SIDE
:
964 if (params
[0] == 1.0f
) {
965 gmesa
->LightingMode
|= LightingModeTwoSides
;
966 gmesa
->MaterialMode
|= MaterialModeTwoSides
;
968 gmesa
->LightingMode
&= ~LightingModeTwoSides
;
969 gmesa
->MaterialMode
&= ~MaterialModeTwoSides
;
971 CHECK_DMA_BUFFER(gmesa
, 2);
972 WRITE(gmesa
->buf
, LightingMode
, gmesa
->LightingMode
);
973 WRITE(gmesa
->buf
, MaterialMode
, gmesa
->MaterialMode
);
979 static void gammaDDShadeModel( GLcontext
*ctx
, GLenum mode
)
981 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
982 CARD32 g
= gmesa
->GeometryMode
;
983 CARD32 c
= gmesa
->ColorDDAMode
;
985 g
&= ~GM_ShadingMask
;
986 c
&= ~ColorDDAShadingMask
;
994 g
|= GM_GouraudShading
;
995 c
|= ColorDDAGouraud
;
1001 if ( gmesa
->ColorDDAMode
!= c
) {
1002 FLUSH_BATCH( gmesa
);
1003 gmesa
->ColorDDAMode
= c
;
1005 gmesa
->dirty
|= GAMMA_UPLOAD_SHADE
;
1008 if ( gmesa
->GeometryMode
!= g
) {
1009 FLUSH_BATCH( gmesa
);
1010 gmesa
->GeometryMode
= g
;
1012 gmesa
->dirty
|= GAMMA_UPLOAD_GEOMETRY
;
1016 /* =============================================================
1020 static void gammaDDClearColor( GLcontext
*ctx
, const GLfloat color
[4])
1022 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1024 UNCLAMPED_FLOAT_TO_UBYTE(c
[0], color
[0]);
1025 UNCLAMPED_FLOAT_TO_UBYTE(c
[1], color
[1]);
1026 UNCLAMPED_FLOAT_TO_UBYTE(c
[2], color
[2]);
1027 UNCLAMPED_FLOAT_TO_UBYTE(c
[3], color
[3]);
1029 gmesa
->ClearColor
= gammaPackColor( gmesa
->gammaScreen
->cpp
,
1030 c
[0], c
[1], c
[2], c
[3] );
1032 if (gmesa
->gammaScreen
->cpp
== 2) gmesa
->ClearColor
|= gmesa
->ClearColor
<<16;
1036 static void gammaDDLogicalOpcode( GLcontext
*ctx
, GLenum opcode
)
1038 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1040 FLUSH_BATCH( gmesa
);
1042 if ( ctx
->Color
.ColorLogicOpEnabled
) {
1043 gmesa
->LogicalOpMode
= opcode
<< 1 | LogicalOpModeEnable
;
1045 gmesa
->LogicalOpMode
= LogicalOpModeDisable
;
1048 gmesa
->dirty
|= GAMMA_UPLOAD_LOGICOP
;
1051 static void gammaDDDrawBuffer( GLcontext
*ctx
, GLenum mode
)
1053 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1055 FLUSH_BATCH( gmesa
);
1059 gmesa
->drawOffset
= gmesa
->readOffset
= 0;
1062 gmesa
->drawOffset
= gmesa
->readOffset
= gmesa
->driScreen
->fbHeight
* gmesa
->driScreen
->fbWidth
* gmesa
->gammaScreen
->cpp
;
1067 static void gammaDDReadBuffer( GLcontext
*ctx
, GLenum mode
)
1072 /* =============================================================
1073 * Window position and viewport transformation
1076 void gammaUpdateWindow( GLcontext
*ctx
)
1078 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1079 __DRIdrawablePrivate
*dPriv
= gmesa
->driDrawable
;
1080 GLfloat xoffset
= (GLfloat
)dPriv
->x
;
1081 GLfloat yoffset
= gmesa
->driScreen
->fbHeight
- (GLfloat
)dPriv
->y
- dPriv
->h
;
1082 const GLfloat
*v
= ctx
->Viewport
._WindowMap
.m
;
1084 GLfloat sx
= v
[MAT_SX
];
1085 GLfloat tx
= v
[MAT_TX
] + xoffset
;
1086 GLfloat sy
= v
[MAT_SY
];
1087 GLfloat ty
= v
[MAT_TY
] + yoffset
;
1088 GLfloat sz
= v
[MAT_SZ
] * gmesa
->depth_scale
;
1089 GLfloat tz
= v
[MAT_TZ
] * gmesa
->depth_scale
;
1091 gmesa
->dirty
|= GAMMA_UPLOAD_VIEWPORT
;
1093 gmesa
->ViewportScaleX
= sx
;
1094 gmesa
->ViewportScaleY
= sy
;
1095 gmesa
->ViewportScaleZ
= sz
;
1096 gmesa
->ViewportOffsetX
= tx
;
1097 gmesa
->ViewportOffsetY
= ty
;
1098 gmesa
->ViewportOffsetZ
= tz
;
1103 static void gammaDDViewport( GLcontext
*ctx
, GLint x
, GLint y
,
1104 GLsizei width
, GLsizei height
)
1106 gammaUpdateWindow( ctx
);
1109 static void gammaDDDepthRange( GLcontext
*ctx
, GLclampd nearval
,
1112 gammaUpdateWindow( ctx
);
1115 void gammaUpdateViewportOffset( GLcontext
*ctx
)
1117 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1118 __DRIdrawablePrivate
*dPriv
= gmesa
->driDrawable
;
1119 GLfloat xoffset
= (GLfloat
)dPriv
->x
;
1120 GLfloat yoffset
= gmesa
->driScreen
->fbHeight
- (GLfloat
)dPriv
->y
- dPriv
->h
;
1121 const GLfloat
*v
= ctx
->Viewport
._WindowMap
.m
;
1123 GLfloat tx
= v
[MAT_TX
] + xoffset
;
1124 GLfloat ty
= v
[MAT_TY
] + yoffset
;
1126 if ( gmesa
->ViewportOffsetX
!= tx
||
1127 gmesa
->ViewportOffsetY
!= ty
)
1129 gmesa
->ViewportOffsetX
= tx
;
1130 gmesa
->ViewportOffsetY
= ty
;
1132 gmesa
->new_state
|= GAMMA_NEW_WINDOW
;
1135 gmesa
->new_state
|= GAMMA_NEW_CLIP
;
1143 static void gammaLoadHWMatrix(GLcontext
*ctx
)
1145 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1148 gmesa
->TransformMode
&= ~XM_XformTexture
;
1150 switch (ctx
->Transform
.MatrixMode
) {
1152 gmesa
->TransformMode
|= XM_UseModelViewMatrix
;
1153 m
= ctx
->ModelviewMatrixStack
.Top
->m
;
1154 CHECK_DMA_BUFFER(gmesa
, 16);
1155 WRITEF(gmesa
->buf
, ModelViewMatrix0
, m
[0]);
1156 WRITEF(gmesa
->buf
, ModelViewMatrix1
, m
[1]);
1157 WRITEF(gmesa
->buf
, ModelViewMatrix2
, m
[2]);
1158 WRITEF(gmesa
->buf
, ModelViewMatrix3
, m
[3]);
1159 WRITEF(gmesa
->buf
, ModelViewMatrix4
, m
[4]);
1160 WRITEF(gmesa
->buf
, ModelViewMatrix5
, m
[5]);
1161 WRITEF(gmesa
->buf
, ModelViewMatrix6
, m
[6]);
1162 WRITEF(gmesa
->buf
, ModelViewMatrix7
, m
[7]);
1163 WRITEF(gmesa
->buf
, ModelViewMatrix8
, m
[8]);
1164 WRITEF(gmesa
->buf
, ModelViewMatrix9
, m
[9]);
1165 WRITEF(gmesa
->buf
, ModelViewMatrix10
, m
[10]);
1166 WRITEF(gmesa
->buf
, ModelViewMatrix11
, m
[11]);
1167 WRITEF(gmesa
->buf
, ModelViewMatrix12
, m
[12]);
1168 WRITEF(gmesa
->buf
, ModelViewMatrix13
, m
[13]);
1169 WRITEF(gmesa
->buf
, ModelViewMatrix14
, m
[14]);
1170 WRITEF(gmesa
->buf
, ModelViewMatrix15
, m
[15]);
1173 m
= ctx
->ProjectionMatrixStack
.Top
->m
;
1174 CHECK_DMA_BUFFER(gmesa
, 16);
1175 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix0
, m
[0]);
1176 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix1
, m
[1]);
1177 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix2
, m
[2]);
1178 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix3
, m
[3]);
1179 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix4
, m
[4]);
1180 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix5
, m
[5]);
1181 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix6
, m
[6]);
1182 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix7
, m
[7]);
1183 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix8
, m
[8]);
1184 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix9
, m
[9]);
1185 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix10
, m
[10]);
1186 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix11
, m
[11]);
1187 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix12
, m
[12]);
1188 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix13
, m
[13]);
1189 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix14
, m
[14]);
1190 WRITEF(gmesa
->buf
, ModelViewProjectionMatrix15
, m
[15]);
1193 m
= ctx
->TextureMatrixStack
[0].Top
->m
;
1194 CHECK_DMA_BUFFER(gmesa
, 16);
1195 gmesa
->TransformMode
|= XM_XformTexture
;
1196 WRITEF(gmesa
->buf
, TextureMatrix0
, m
[0]);
1197 WRITEF(gmesa
->buf
, TextureMatrix1
, m
[1]);
1198 WRITEF(gmesa
->buf
, TextureMatrix2
, m
[2]);
1199 WRITEF(gmesa
->buf
, TextureMatrix3
, m
[3]);
1200 WRITEF(gmesa
->buf
, TextureMatrix4
, m
[4]);
1201 WRITEF(gmesa
->buf
, TextureMatrix5
, m
[5]);
1202 WRITEF(gmesa
->buf
, TextureMatrix6
, m
[6]);
1203 WRITEF(gmesa
->buf
, TextureMatrix7
, m
[7]);
1204 WRITEF(gmesa
->buf
, TextureMatrix8
, m
[8]);
1205 WRITEF(gmesa
->buf
, TextureMatrix9
, m
[9]);
1206 WRITEF(gmesa
->buf
, TextureMatrix10
, m
[10]);
1207 WRITEF(gmesa
->buf
, TextureMatrix11
, m
[11]);
1208 WRITEF(gmesa
->buf
, TextureMatrix12
, m
[12]);
1209 WRITEF(gmesa
->buf
, TextureMatrix13
, m
[13]);
1210 WRITEF(gmesa
->buf
, TextureMatrix14
, m
[14]);
1211 WRITEF(gmesa
->buf
, TextureMatrix15
, m
[15]);
1215 /* ERROR!!! -- how did this happen? */
1219 gmesa
->dirty
|= GAMMA_UPLOAD_TRANSFORM
;
1223 /* =============================================================
1224 * State enable/disable
1227 static void gammaDDEnable( GLcontext
*ctx
, GLenum cap
, GLboolean state
)
1229 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1234 FLUSH_BATCH( gmesa
);
1235 gmesa
->new_state
|= GAMMA_NEW_ALPHA
;
1239 FLUSH_BATCH( gmesa
);
1240 gmesa
->new_state
|= GAMMA_NEW_CULL
;
1244 FLUSH_BATCH( gmesa
);
1245 gmesa
->new_state
|= GAMMA_NEW_DEPTH
;
1250 CARD32 d
= gmesa
->DitherMode
;
1251 FLUSH_BATCH( gmesa
);
1254 d
|= DM_DitherEnable
;
1256 d
&= ~DM_DitherEnable
;
1259 if ( gmesa
->DitherMode
!= d
) {
1260 gmesa
->DitherMode
= d
;
1261 gmesa
->dirty
|= GAMMA_UPLOAD_DITHER
;
1268 FLUSH_BATCH( gmesa
);
1269 gmesa
->new_state
|= GAMMA_NEW_FOG
;
1273 case GL_INDEX_LOGIC_OP
:
1274 case GL_COLOR_LOGIC_OP
:
1275 FLUSH_BATCH( gmesa
);
1276 gmesa
->new_state
|= GAMMA_NEW_LOGICOP
;
1282 CARD32 l
= gmesa
->LightingMode
;
1283 FLUSH_BATCH( gmesa
);
1286 l
|= LightingModeEnable
;
1288 l
&= ~LightingModeEnable
;
1291 if ( gmesa
->LightingMode
!= l
) {
1292 gmesa
->LightingMode
= l
;
1293 gmesa
->dirty
|= GAMMA_UPLOAD_LIGHT
;
1298 case GL_COLOR_MATERIAL
:
1300 CARD32 m
= gmesa
->MaterialMode
;
1301 FLUSH_BATCH( gmesa
);
1304 m
|= MaterialModeEnable
;
1306 m
&= ~MaterialModeEnable
;
1309 if ( gmesa
->MaterialMode
!= m
) {
1310 gmesa
->MaterialMode
= m
;
1311 gmesa
->dirty
|= GAMMA_UPLOAD_LIGHT
;
1317 case GL_LINE_SMOOTH
:
1318 FLUSH_BATCH( gmesa
);
1320 gmesa
->AntialiasMode
|= AntialiasModeEnable
;
1321 gmesa
->LineMode
|= LM_AntialiasEnable
;
1323 gmesa
->AntialiasMode
&= ~AntialiasModeEnable
;
1324 gmesa
->LineMode
&= ~LM_AntialiasEnable
;
1326 gmesa
->dirty
|= GAMMA_UPLOAD_LINEMODE
;
1329 case GL_POINT_SMOOTH
:
1330 FLUSH_BATCH( gmesa
);
1332 gmesa
->AntialiasMode
|= AntialiasModeEnable
;
1333 gmesa
->PointMode
|= PM_AntialiasEnable
;
1335 gmesa
->AntialiasMode
&= ~AntialiasModeEnable
;
1336 gmesa
->PointMode
&= ~PM_AntialiasEnable
;
1338 gmesa
->dirty
|= GAMMA_UPLOAD_POINTMODE
;
1341 case GL_POLYGON_SMOOTH
:
1342 FLUSH_BATCH( gmesa
);
1344 gmesa
->AntialiasMode
|= AntialiasModeEnable
;
1345 gmesa
->TriangleMode
|= TM_AntialiasEnable
;
1347 gmesa
->AntialiasMode
&= ~AntialiasModeEnable
;
1348 gmesa
->TriangleMode
&= ~TM_AntialiasEnable
;
1350 gmesa
->dirty
|= GAMMA_UPLOAD_TRIMODE
;
1353 case GL_SCISSOR_TEST
:
1354 FLUSH_BATCH( gmesa
);
1355 gmesa
->new_state
|= GAMMA_NEW_CLIP
;
1358 case GL_POLYGON_OFFSET_FILL
:
1359 case GL_POLYGON_OFFSET_POINT
:
1360 case GL_POLYGON_OFFSET_LINE
:
1361 FLUSH_BATCH( gmesa
);
1362 gmesa
->new_state
|= GAMMA_NEW_POLYGON
;
1365 case GL_LINE_STIPPLE
:
1366 FLUSH_BATCH( gmesa
);
1368 gmesa
->LineMode
|= LM_StippleEnable
;
1370 gmesa
->LineMode
&= ~LM_StippleEnable
;
1371 gmesa
->dirty
|= GAMMA_UPLOAD_LINEMODE
;
1374 case GL_POLYGON_STIPPLE
:
1375 FLUSH_BATCH( gmesa
);
1376 gmesa
->new_state
|= GAMMA_NEW_STIPPLE
;
1384 /* =============================================================
1385 * State initialization, management
1390 * Load the current context's state into the hardware.
1392 * NOTE: Be VERY careful about ensuring the context state is marked for
1393 * upload, the only place it shouldn't be uploaded is when the setup
1394 * state has changed in ReducedPrimitiveChange as this comes right after
1397 * Blits of any type should always upload the context and masks after
1400 void gammaEmitHwState( gammaContextPtr gmesa
)
1402 if (!gmesa
->driDrawable
) return;
1404 if (!gmesa
->dirty
) return;
1407 /* Flush any partially filled buffers */
1408 FLUSH_DMA_BUFFER(gmesa
);
1410 DRM_SPINLOCK(&gmesa
->driScreen
->pSAREA
->drawable_lock
,
1411 gmesa
->driScreen
->drawLockID
);
1412 VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa
);
1415 if (gmesa
->dirty
& GAMMA_UPLOAD_VIEWPORT
) {
1416 gmesa
->dirty
&= ~GAMMA_UPLOAD_VIEWPORT
;
1417 CHECK_DMA_BUFFER(gmesa
, 6);
1418 WRITEF(gmesa
->buf
, ViewPortOffsetX
, gmesa
->ViewportOffsetX
);
1419 WRITEF(gmesa
->buf
, ViewPortOffsetY
, gmesa
->ViewportOffsetY
);
1420 WRITEF(gmesa
->buf
, ViewPortOffsetZ
, gmesa
->ViewportOffsetZ
);
1421 WRITEF(gmesa
->buf
, ViewPortScaleX
, gmesa
->ViewportScaleX
);
1422 WRITEF(gmesa
->buf
, ViewPortScaleY
, gmesa
->ViewportScaleY
);
1423 WRITEF(gmesa
->buf
, ViewPortScaleZ
, gmesa
->ViewportScaleZ
);
1425 if ( (gmesa
->dirty
& GAMMA_UPLOAD_POINTMODE
) ||
1426 (gmesa
->dirty
& GAMMA_UPLOAD_LINEMODE
) ||
1427 (gmesa
->dirty
& GAMMA_UPLOAD_TRIMODE
) ) {
1428 CHECK_DMA_BUFFER(gmesa
, 1);
1429 WRITE(gmesa
->buf
, AntialiasMode
, gmesa
->AntialiasMode
);
1431 if (gmesa
->dirty
& GAMMA_UPLOAD_POINTMODE
) {
1432 gmesa
->dirty
&= ~GAMMA_UPLOAD_POINTMODE
;
1433 CHECK_DMA_BUFFER(gmesa
, 1);
1434 WRITE(gmesa
->buf
, PointMode
, gmesa
->PointMode
);
1436 if (gmesa
->dirty
& GAMMA_UPLOAD_LINEMODE
) {
1437 gmesa
->dirty
&= ~GAMMA_UPLOAD_LINEMODE
;
1438 CHECK_DMA_BUFFER(gmesa
, 2);
1439 WRITE(gmesa
->buf
, LineMode
, gmesa
->LineMode
);
1440 WRITE(gmesa
->buf
, LineStippleMode
, gmesa
->LineMode
);
1442 if (gmesa
->dirty
& GAMMA_UPLOAD_TRIMODE
) {
1443 gmesa
->dirty
&= ~GAMMA_UPLOAD_TRIMODE
;
1444 CHECK_DMA_BUFFER(gmesa
, 1);
1445 WRITE(gmesa
->buf
, TriangleMode
, gmesa
->TriangleMode
);
1447 if (gmesa
->dirty
& GAMMA_UPLOAD_FOG
) {
1449 UNCLAMPED_FLOAT_TO_RGB_CHAN( c
, gmesa
->glCtx
->Fog
.Color
);
1450 col
= gammaPackColor(4, c
[0], c
[1], c
[2], 0);
1451 gmesa
->dirty
&= ~GAMMA_UPLOAD_FOG
;
1452 CHECK_DMA_BUFFER(gmesa
, 5);
1454 WRITE(gmesa
->buf
, FogMode
, gmesa
->FogMode
);
1455 WRITE(gmesa
->buf
, FogColor
, col
);
1456 WRITEF(gmesa
->buf
, FStart
, gmesa
->glCtx
->Fog
.Start
);
1458 WRITEF(gmesa
->buf
, FogEnd
, gmesa
->glCtx
->Fog
.End
);
1459 WRITEF(gmesa
->buf
, FogDensity
, gmesa
->glCtx
->Fog
.Density
);
1460 WRITEF(gmesa
->buf
, FogScale
,
1461 1.0f
/(gmesa
->glCtx
->Fog
.End
- gmesa
->glCtx
->Fog
.Start
));
1463 if (gmesa
->dirty
& GAMMA_UPLOAD_DITHER
) {
1464 gmesa
->dirty
&= ~GAMMA_UPLOAD_DITHER
;
1465 CHECK_DMA_BUFFER(gmesa
, 1);
1466 WRITE(gmesa
->buf
, DitherMode
, gmesa
->DitherMode
);
1468 if (gmesa
->dirty
& GAMMA_UPLOAD_LOGICOP
) {
1469 gmesa
->dirty
&= ~GAMMA_UPLOAD_LOGICOP
;
1470 CHECK_DMA_BUFFER(gmesa
, 1);
1471 WRITE(gmesa
->buf
, LogicalOpMode
, gmesa
->LogicalOpMode
);
1473 if (gmesa
->dirty
& GAMMA_UPLOAD_CLIP
) {
1474 gmesa
->dirty
&= ~GAMMA_UPLOAD_CLIP
;
1475 CHECK_DMA_BUFFER(gmesa
, 3);
1476 WRITE(gmesa
->buf
, ScissorMinXY
, gmesa
->ScissorMinXY
);
1477 WRITE(gmesa
->buf
, ScissorMaxXY
, gmesa
->ScissorMaxXY
);
1478 WRITE(gmesa
->buf
, ScissorMode
, gmesa
->ScissorMode
);
1480 if (gmesa
->dirty
& GAMMA_UPLOAD_MASKS
) {
1481 gmesa
->dirty
&= ~GAMMA_UPLOAD_MASKS
;
1482 CHECK_DMA_BUFFER(gmesa
, 1);
1483 WRITE(gmesa
->buf
, FBHardwareWriteMask
, gmesa
->FBHardwareWriteMask
);
1485 if (gmesa
->dirty
& GAMMA_UPLOAD_ALPHA
) {
1486 gmesa
->dirty
&= ~GAMMA_UPLOAD_ALPHA
;
1487 CHECK_DMA_BUFFER(gmesa
, 1);
1488 WRITE(gmesa
->buf
, AlphaTestMode
, gmesa
->AlphaTestMode
);
1490 if (gmesa
->dirty
& GAMMA_UPLOAD_BLEND
) {
1491 gmesa
->dirty
&= ~GAMMA_UPLOAD_BLEND
;
1492 CHECK_DMA_BUFFER(gmesa
, 1);
1493 WRITE(gmesa
->buf
, AlphaBlendMode
, gmesa
->AlphaBlendMode
);
1495 CHECK_DMA_BUFFER(gmesa
, 1);
1496 if (gmesa
->glCtx
->Color
.BlendEnabled
|| gmesa
->glCtx
->Color
.AlphaEnabled
) {
1497 WRITE(gmesa
->buf
, FBReadMode
, gmesa
->FBReadMode
| gmesa
->AB_FBReadMode_Save
);
1499 WRITE(gmesa
->buf
, FBReadMode
, gmesa
->FBReadMode
);
1501 if (gmesa
->dirty
& GAMMA_UPLOAD_LIGHT
) {
1502 gmesa
->dirty
&= ~GAMMA_UPLOAD_LIGHT
;
1503 CHECK_DMA_BUFFER(gmesa
, 2);
1504 WRITE(gmesa
->buf
, LightingMode
, gmesa
->LightingMode
);
1505 WRITE(gmesa
->buf
, MaterialMode
, gmesa
->MaterialMode
);
1507 if (gmesa
->dirty
& GAMMA_UPLOAD_SHADE
) {
1508 gmesa
->dirty
&= ~GAMMA_UPLOAD_SHADE
;
1509 CHECK_DMA_BUFFER(gmesa
, 1);
1510 WRITE(gmesa
->buf
, ColorDDAMode
, gmesa
->ColorDDAMode
);
1512 if (gmesa
->dirty
& GAMMA_UPLOAD_POLYGON
) {
1513 gmesa
->dirty
&= ~GAMMA_UPLOAD_POLYGON
;
1514 CHECK_DMA_BUFFER(gmesa
, 2);
1515 WRITEF(gmesa
->buf
, PolygonOffsetBias
, gmesa
->glCtx
->Polygon
.OffsetUnits
);
1516 WRITEF(gmesa
->buf
, PolygonOffsetFactor
, gmesa
->glCtx
->Polygon
.OffsetFactor
);
1518 if (gmesa
->dirty
& GAMMA_UPLOAD_STIPPLE
) {
1519 gmesa
->dirty
&= ~GAMMA_UPLOAD_STIPPLE
;
1520 CHECK_DMA_BUFFER(gmesa
, 33);
1521 WRITE(gmesa
->buf
, AreaStippleMode
, gmesa
->AreaStippleMode
);
1522 WRITE(gmesa
->buf
, AreaStipplePattern0
, gmesa
->glCtx
->PolygonStipple
[0]);
1523 WRITE(gmesa
->buf
, AreaStipplePattern1
, gmesa
->glCtx
->PolygonStipple
[1]);
1524 WRITE(gmesa
->buf
, AreaStipplePattern2
, gmesa
->glCtx
->PolygonStipple
[2]);
1525 WRITE(gmesa
->buf
, AreaStipplePattern3
, gmesa
->glCtx
->PolygonStipple
[3]);
1526 WRITE(gmesa
->buf
, AreaStipplePattern4
, gmesa
->glCtx
->PolygonStipple
[4]);
1527 WRITE(gmesa
->buf
, AreaStipplePattern5
, gmesa
->glCtx
->PolygonStipple
[5]);
1528 WRITE(gmesa
->buf
, AreaStipplePattern6
, gmesa
->glCtx
->PolygonStipple
[6]);
1529 WRITE(gmesa
->buf
, AreaStipplePattern7
, gmesa
->glCtx
->PolygonStipple
[7]);
1530 WRITE(gmesa
->buf
, AreaStipplePattern8
, gmesa
->glCtx
->PolygonStipple
[8]);
1531 WRITE(gmesa
->buf
, AreaStipplePattern9
, gmesa
->glCtx
->PolygonStipple
[9]);
1532 WRITE(gmesa
->buf
, AreaStipplePattern10
, gmesa
->glCtx
->PolygonStipple
[10]);
1533 WRITE(gmesa
->buf
, AreaStipplePattern11
, gmesa
->glCtx
->PolygonStipple
[11]);
1534 WRITE(gmesa
->buf
, AreaStipplePattern12
, gmesa
->glCtx
->PolygonStipple
[12]);
1535 WRITE(gmesa
->buf
, AreaStipplePattern13
, gmesa
->glCtx
->PolygonStipple
[13]);
1536 WRITE(gmesa
->buf
, AreaStipplePattern14
, gmesa
->glCtx
->PolygonStipple
[14]);
1537 WRITE(gmesa
->buf
, AreaStipplePattern15
, gmesa
->glCtx
->PolygonStipple
[15]);
1538 WRITE(gmesa
->buf
, AreaStipplePattern16
, gmesa
->glCtx
->PolygonStipple
[16]);
1539 WRITE(gmesa
->buf
, AreaStipplePattern17
, gmesa
->glCtx
->PolygonStipple
[17]);
1540 WRITE(gmesa
->buf
, AreaStipplePattern18
, gmesa
->glCtx
->PolygonStipple
[18]);
1541 WRITE(gmesa
->buf
, AreaStipplePattern19
, gmesa
->glCtx
->PolygonStipple
[19]);
1542 WRITE(gmesa
->buf
, AreaStipplePattern20
, gmesa
->glCtx
->PolygonStipple
[20]);
1543 WRITE(gmesa
->buf
, AreaStipplePattern21
, gmesa
->glCtx
->PolygonStipple
[21]);
1544 WRITE(gmesa
->buf
, AreaStipplePattern22
, gmesa
->glCtx
->PolygonStipple
[22]);
1545 WRITE(gmesa
->buf
, AreaStipplePattern23
, gmesa
->glCtx
->PolygonStipple
[23]);
1546 WRITE(gmesa
->buf
, AreaStipplePattern24
, gmesa
->glCtx
->PolygonStipple
[24]);
1547 WRITE(gmesa
->buf
, AreaStipplePattern25
, gmesa
->glCtx
->PolygonStipple
[25]);
1548 WRITE(gmesa
->buf
, AreaStipplePattern26
, gmesa
->glCtx
->PolygonStipple
[26]);
1549 WRITE(gmesa
->buf
, AreaStipplePattern27
, gmesa
->glCtx
->PolygonStipple
[27]);
1550 WRITE(gmesa
->buf
, AreaStipplePattern28
, gmesa
->glCtx
->PolygonStipple
[28]);
1551 WRITE(gmesa
->buf
, AreaStipplePattern29
, gmesa
->glCtx
->PolygonStipple
[29]);
1552 WRITE(gmesa
->buf
, AreaStipplePattern30
, gmesa
->glCtx
->PolygonStipple
[30]);
1553 WRITE(gmesa
->buf
, AreaStipplePattern31
, gmesa
->glCtx
->PolygonStipple
[31]);
1555 if (gmesa
->dirty
& GAMMA_UPLOAD_DEPTH
) {
1556 gmesa
->dirty
&= ~GAMMA_UPLOAD_DEPTH
;
1557 CHECK_DMA_BUFFER(gmesa
, 4);
1558 WRITE(gmesa
->buf
, DepthMode
, gmesa
->DepthMode
);
1559 WRITE(gmesa
->buf
, DeltaMode
, gmesa
->DeltaMode
);
1560 WRITE(gmesa
->buf
, GLINTWindow
,gmesa
->Window
| (gmesa
->FrameCount
<< 9));
1561 WRITE(gmesa
->buf
, LBReadMode
, gmesa
->LBReadMode
);
1563 if (gmesa
->dirty
& GAMMA_UPLOAD_GEOMETRY
) {
1564 gmesa
->dirty
&= ~GAMMA_UPLOAD_GEOMETRY
;
1565 CHECK_DMA_BUFFER(gmesa
, 1);
1566 WRITE(gmesa
->buf
, GeometryMode
, gmesa
->GeometryMode
);
1568 if (gmesa
->dirty
& GAMMA_UPLOAD_TRANSFORM
) {
1569 gmesa
->dirty
&= ~GAMMA_UPLOAD_TRANSFORM
;
1570 CHECK_DMA_BUFFER(gmesa
, 1);
1571 WRITE(gmesa
->buf
, TransformMode
, gmesa
->TransformMode
);
1573 if (gmesa
->dirty
& GAMMA_UPLOAD_TEX0
) {
1574 gammaTextureObjectPtr curTex
= gmesa
->CurrentTexObj
[0];
1575 gmesa
->dirty
&= ~GAMMA_UPLOAD_TEX0
;
1577 CHECK_DMA_BUFFER(gmesa
, 21);
1578 WRITE(gmesa
->buf
, GeometryMode
, gmesa
->GeometryMode
| GM_TextureEnable
);
1579 WRITE(gmesa
->buf
, DeltaMode
, gmesa
->DeltaMode
| DM_TextureEnable
);
1580 WRITE(gmesa
->buf
, TextureAddressMode
, curTex
->TextureAddressMode
);
1581 WRITE(gmesa
->buf
, TextureReadMode
, curTex
->TextureReadMode
);
1582 WRITE(gmesa
->buf
, TextureColorMode
, curTex
->TextureColorMode
);
1583 WRITE(gmesa
->buf
, TextureFilterMode
, curTex
->TextureFilterMode
);
1584 WRITE(gmesa
->buf
, TextureFormat
, curTex
->TextureFormat
);
1585 WRITE(gmesa
->buf
, GLINTBorderColor
, curTex
->TextureBorderColor
);
1586 WRITE(gmesa
->buf
, TxBaseAddr0
, curTex
->TextureBaseAddr
[0]);
1587 WRITE(gmesa
->buf
, TxBaseAddr1
, curTex
->TextureBaseAddr
[1]);
1588 WRITE(gmesa
->buf
, TxBaseAddr2
, curTex
->TextureBaseAddr
[2]);
1589 WRITE(gmesa
->buf
, TxBaseAddr3
, curTex
->TextureBaseAddr
[3]);
1590 WRITE(gmesa
->buf
, TxBaseAddr4
, curTex
->TextureBaseAddr
[4]);
1591 WRITE(gmesa
->buf
, TxBaseAddr5
, curTex
->TextureBaseAddr
[5]);
1592 WRITE(gmesa
->buf
, TxBaseAddr6
, curTex
->TextureBaseAddr
[6]);
1593 WRITE(gmesa
->buf
, TxBaseAddr7
, curTex
->TextureBaseAddr
[7]);
1594 WRITE(gmesa
->buf
, TxBaseAddr8
, curTex
->TextureBaseAddr
[8]);
1595 WRITE(gmesa
->buf
, TxBaseAddr9
, curTex
->TextureBaseAddr
[9]);
1596 WRITE(gmesa
->buf
, TxBaseAddr10
, curTex
->TextureBaseAddr
[10]);
1597 WRITE(gmesa
->buf
, TxBaseAddr11
, curTex
->TextureBaseAddr
[11]);
1598 WRITE(gmesa
->buf
, TxBaseAddr12
, curTex
->TextureBaseAddr
[12]);
1599 WRITE(gmesa
->buf
, TextureCacheControl
, (TCC_Enable
| TCC_Invalidate
));
1601 CHECK_DMA_BUFFER(gmesa
, 6);
1602 WRITE(gmesa
->buf
, GeometryMode
, gmesa
->GeometryMode
);
1603 WRITE(gmesa
->buf
, DeltaMode
, gmesa
->DeltaMode
);
1604 WRITE(gmesa
->buf
, TextureAddressMode
, TextureAddressModeDisable
);
1605 WRITE(gmesa
->buf
, TextureReadMode
, TextureReadModeDisable
);
1606 WRITE(gmesa
->buf
, TextureFilterMode
, TextureFilterModeDisable
);
1607 WRITE(gmesa
->buf
, TextureColorMode
, TextureColorModeDisable
);
1611 PROCESS_DMA_BUFFER_TOP_HALF(gmesa
);
1613 DRM_SPINUNLOCK(&gmesa
->driScreen
->pSAREA
->drawable_lock
,
1614 gmesa
->driScreen
->drawLockID
);
1615 VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(gmesa
);
1617 PROCESS_DMA_BUFFER_BOTTOM_HALF(gmesa
);
1621 void gammaDDUpdateHWState( GLcontext
*ctx
)
1623 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
1624 int new_state
= gmesa
->new_state
;
1628 FLUSH_BATCH( gmesa
);
1630 gmesa
->new_state
= 0;
1632 /* Update the various parts of the context's state.
1634 if ( new_state
& GAMMA_NEW_ALPHA
)
1635 gammaUpdateAlphaMode( ctx
);
1637 if ( new_state
& GAMMA_NEW_DEPTH
)
1638 gammaUpdateZMode( ctx
);
1640 if ( new_state
& GAMMA_NEW_FOG
)
1641 gammaUpdateFogAttrib( ctx
);
1643 if ( new_state
& GAMMA_NEW_CLIP
)
1644 gammaUpdateClipping( ctx
);
1646 if ( new_state
& GAMMA_NEW_POLYGON
)
1647 gammaUpdatePolygon( ctx
);
1649 if ( new_state
& GAMMA_NEW_CULL
)
1650 gammaUpdateCull( ctx
);
1652 if ( new_state
& GAMMA_NEW_MASKS
)
1653 gammaUpdateMasks( ctx
);
1655 if ( new_state
& GAMMA_NEW_WINDOW
)
1656 gammaUpdateWindow( ctx
);
1658 if ( new_state
& GAMMA_NEW_STIPPLE
)
1659 gammaUpdateStipple( ctx
);
1664 gammaEmitHwState( gmesa
);
1668 static void gammaDDUpdateState( GLcontext
*ctx
, GLuint new_state
)
1670 _swrast_InvalidateState( ctx
, new_state
);
1671 _swsetup_InvalidateState( ctx
, new_state
);
1672 _ac_InvalidateState( ctx
, new_state
);
1673 _tnl_InvalidateState( ctx
, new_state
);
1674 GAMMA_CONTEXT(ctx
)->new_gl_state
|= new_state
;
1678 /* Initialize the context's hardware state.
1680 void gammaDDInitState( gammaContextPtr gmesa
)
1682 gmesa
->new_state
= 0;
1685 /* Initialize the driver's state functions.
1687 void gammaDDInitStateFuncs( GLcontext
*ctx
)
1689 ctx
->Driver
.UpdateState
= gammaDDUpdateState
;
1691 ctx
->Driver
.Clear
= gammaDDClear
;
1692 ctx
->Driver
.ClearIndex
= NULL
;
1693 ctx
->Driver
.ClearColor
= gammaDDClearColor
;
1694 ctx
->Driver
.DrawBuffer
= gammaDDDrawBuffer
;
1695 ctx
->Driver
.ReadBuffer
= gammaDDReadBuffer
;
1697 ctx
->Driver
.IndexMask
= NULL
;
1698 ctx
->Driver
.ColorMask
= gammaDDColorMask
;
1700 ctx
->Driver
.AlphaFunc
= gammaDDAlphaFunc
;
1701 ctx
->Driver
.BlendEquation
= gammaDDBlendEquation
;
1702 ctx
->Driver
.BlendFunc
= gammaDDBlendFunc
;
1703 ctx
->Driver
.BlendFuncSeparate
= gammaDDBlendFuncSeparate
;
1704 ctx
->Driver
.ClearDepth
= gammaDDClearDepth
;
1705 ctx
->Driver
.CullFace
= gammaDDCullFace
;
1706 ctx
->Driver
.FrontFace
= gammaDDFrontFace
;
1707 ctx
->Driver
.DepthFunc
= gammaDDDepthFunc
;
1708 ctx
->Driver
.DepthMask
= gammaDDDepthMask
;
1709 ctx
->Driver
.DepthRange
= gammaDDDepthRange
;
1710 ctx
->Driver
.Enable
= gammaDDEnable
;
1711 ctx
->Driver
.Finish
= gammaDDFinish
;
1712 ctx
->Driver
.Flush
= gammaDDFlush
;
1714 ctx
->Driver
.Fogfv
= gammaDDFogfv
;
1716 ctx
->Driver
.Hint
= NULL
;
1717 ctx
->Driver
.LineWidth
= gammaDDLineWidth
;
1718 ctx
->Driver
.LineStipple
= gammaDDLineStipple
;
1720 ctx
->Driver
.Lightfv
= gammaDDLightfv
;
1721 ctx
->Driver
.LightModelfv
= gammaDDLightModelfv
;
1723 ctx
->Driver
.LogicOpcode
= gammaDDLogicalOpcode
;
1724 ctx
->Driver
.PointSize
= gammaDDPointSize
;
1725 ctx
->Driver
.PolygonMode
= gammaDDPolygonMode
;
1726 ctx
->Driver
.PolygonStipple
= gammaDDPolygonStipple
;
1727 ctx
->Driver
.Scissor
= gammaDDScissor
;
1728 ctx
->Driver
.ShadeModel
= gammaDDShadeModel
;
1729 ctx
->Driver
.ClearStencil
= NULL
;
1730 ctx
->Driver
.StencilFunc
= NULL
;
1731 ctx
->Driver
.StencilMask
= NULL
;
1732 ctx
->Driver
.StencilOp
= NULL
;
1733 ctx
->Driver
.Viewport
= gammaDDViewport
;