2 * Mesa 3-D graphics library
5 * Copyright (C) 1999 Brian Paul All Rights Reserved.
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Keith Whitwell <keithw@valinux.com>
35 * For texture sampling:
37 typedef void (*TextureSampleFunc
)( GLcontext
*ctx
, GLuint texUnit
,
38 const struct gl_texture_object
*tObj
,
40 const GLfloat s
[], const GLfloat t
[],
41 const GLfloat u
[], const GLfloat lambda
[],
50 typedef void (_ASMAPIP blend_func
)( GLcontext
*ctx
, GLuint n
,
52 GLchan src
[][4], CONST GLchan dst
[][4] );
54 typedef void (*blend_func
)( GLcontext
*ctx
, GLuint n
, const GLubyte mask
[],
55 GLchan src
[][4], CONST GLchan dst
[][4] );
58 typedef void (*swrast_tri_func
)( GLcontext
*ctx
,
59 SWvertex
*, SWvertex
*, SWvertex
*);
60 typedef void (*swrast_line_func
)( GLcontext
*ctx
, SWvertex
*, SWvertex
*);
61 typedef void (*swrast_point_func
)( GLcontext
*ctx
, SWvertex
*);
64 * Bitmasks to indicate which rasterization options are enabled (RasterMask)
66 #define ALPHATEST_BIT 0x001 /* Alpha-test pixels */
67 #define BLEND_BIT 0x002 /* Blend pixels */
68 #define DEPTH_BIT 0x004 /* Depth-test pixels */
69 #define FOG_BIT 0x008 /* Fog pixels */
70 #define LOGIC_OP_BIT 0x010 /* Apply logic op in software */
71 #define SCISSOR_BIT 0x020 /* Scissor pixels */
72 #define STENCIL_BIT 0x040 /* Stencil pixels */
73 #define MASKING_BIT 0x080 /* Do glColorMask or glIndexMask */
74 #define ALPHABUF_BIT 0x100 /* Using software alpha buffer */
75 #define WINCLIP_BIT 0x200 /* Clip pixels/primitives to window */
76 #define MULTI_DRAW_BIT 0x400 /* Write to more than one color- */
77 /* buffer or no buffers. */
78 #define OCCLUSION_BIT 0x800 /* GL_HP_occlusion_test enabled */
79 #define TEXTURE_BIT 0x1000 /* Texturing really enabled */
82 #define _SWRAST_NEW_RASTERMASK (_NEW_BUFFERS| \
96 /* Configuration mechanisms to make software rasterizer match
97 * characteristics of the hardware rasterizer (if present):
99 GLboolean AllowVertexFog
;
100 GLboolean AllowPixelFog
;
102 /* Derived values, invalidated on statechanges, updated from
103 * _swrast_validate_derived():
106 GLboolean _MultiTextureEnabled
;
107 GLuint _MinMagThresh
[MAX_TEXTURE_UNITS
];
108 GLfloat _backface_sign
;
109 GLboolean _PreferPixelFog
;
111 /* Accum buffer temporaries.
113 GLboolean _IntegerAccumMode
; /* Storing unscaled integers? */
114 GLfloat _IntegerAccumScaler
; /* Implicit scale factor */
119 struct pixel_buffer
* PB
;
120 GLuint StippleCounter
; /* Line stipple counter */
124 /* Mechanism to allow driver (like X11) to register further
125 * software rasterization routines.
127 void (*choose_point
)( GLcontext
* );
128 void (*choose_line
)( GLcontext
* );
129 void (*choose_triangle
)( GLcontext
* );
130 void (*choose_quad
)( GLcontext
* );
132 GLuint invalidate_point
;
133 GLuint invalidate_line
;
134 GLuint invalidate_triangle
;
135 GLuint invalidate_quad
;
138 /* Function pointers for dispatch behind public entrypoints.
140 void (*InvalidateState
)( GLcontext
*ctx
, GLuint new_state
);
141 void (*Point
)( GLcontext
*ctx
, SWvertex
*v
);
142 void (*Line
)( GLcontext
*ctx
, SWvertex
*v0
, SWvertex
*v1
);
143 void (*Triangle
)( GLcontext
*ctx
, SWvertex
*v0
, SWvertex
*v1
, SWvertex
*v2
);
144 void (*Quad
)( GLcontext
*ctx
, SWvertex
*v0
, SWvertex
*v1
, SWvertex
*v2
,
147 /* Internal hooks, kept uptodate by the same mechanism as above.
149 blend_func BlendFunc
;
150 TextureSampleFunc TextureSample
[MAX_TEXTURE_UNITS
];
156 _swrast_validate_derived( GLcontext
*ctx
);
159 #define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context)