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 /* The software rasterizer now uses this format for vertices. Thus a
36 * 'RasterSetup' stage or other translation is required between the
37 * tnl module and the swrast rasterization functions. This serves to
38 * isolate the swrast module from the internals of the tnl module, and
39 * improve its usefulness as a fallback mechanism for hardware
42 * Full software drivers:
43 * - Register the rastersetup and triangle functions from
44 * utils/software_helper.
45 * - On statechange, update the rasterization pointers in that module.
47 * Rasterization hardware drivers:
48 * - Keep native rastersetup.
49 * - Implement native twoside,offset and unfilled triangle setup.
50 * - Implement a translator from native vertices to swrast vertices.
51 * - On partial fallback (mix of accelerated and unaccelerated
52 * prims), call a pass-through function which translates native
53 * vertices to SWvertices and calls the appropriate swrast function.
54 * - On total fallback (vertex format insufficient for state or all
55 * primitives unaccelerated), hook in swrast_setup instead.
59 GLfloat eye
[4]; /* for GL_EXT_point_param only */
60 GLfloat texcoord
[MAX_TEXTURE_UNITS
][4];
70 /* These are the public-access functions exported from swrast.
73 _swrast_alloc_buffers( GLcontext
*ctx
);
76 _swrast_CreateContext( GLcontext
*ctx
);
79 _swrast_DestroyContext( GLcontext
*ctx
);
84 _swrast_Bitmap( GLcontext
*ctx
,
86 GLsizei width
, GLsizei height
,
87 const struct gl_pixelstore_attrib
*unpack
,
88 const GLubyte
*bitmap
);
91 _swrast_CopyPixels( GLcontext
*ctx
,
92 GLint srcx
, GLint srcy
,
93 GLint destx
, GLint desty
,
94 GLsizei width
, GLsizei height
,
98 _swrast_DrawPixels( GLcontext
*ctx
,
100 GLsizei width
, GLsizei height
,
101 GLenum format
, GLenum type
,
102 const struct gl_pixelstore_attrib
*unpack
,
103 const GLvoid
*pixels
);
106 _swrast_ReadPixels( GLcontext
*ctx
,
107 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
108 GLenum format
, GLenum type
,
109 const struct gl_pixelstore_attrib
*unpack
,
113 _swrast_Clear( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
114 GLint x
, GLint y
, GLint width
, GLint height
);
117 _swrast_Accum( GLcontext
*ctx
, GLenum op
,
118 GLfloat value
, GLint xpos
, GLint ypos
,
119 GLint width
, GLint height
);
122 /* Get a pointer to the stipple counter.
125 _swrast_get_stipple_counter_ref( GLcontext
*ctx
);
128 /* These will always render the correct point/line/triangle for the
132 _swrast_Point( GLcontext
*ctx
, SWvertex
*v
);
135 _swrast_Line( GLcontext
*ctx
, SWvertex
*v0
, SWvertex
*v1
);
138 _swrast_Triangle( GLcontext
*ctx
, SWvertex
*v0
, SWvertex
*v1
, SWvertex
*v2
);
141 _swrast_Quad( GLcontext
*ctx
, SWvertex
*v0
, SWvertex
*v1
, SWvertex
*v2
,
145 _swrast_flush( GLcontext
*ctx
);
148 /* Tell the software rasterizer about core state changes.
151 _swrast_InvalidateState( GLcontext
*ctx
, GLuint new_state
);
153 /* Configure software rasterizer to match hardware rasterizer characteristics:
156 _swrast_allow_vertex_fog( GLcontext
*ctx
, GLboolean value
);
159 _swrast_allow_pixel_fog( GLcontext
*ctx
, GLboolean value
);