1 /* $Id: swrast.h,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * Keith Whitwell <keithw@valinux.com>
37 /* The software rasterizer now uses this format for vertices. Thus a
38 * 'RasterSetup' stage or other translation is required between the
39 * tnl module and the swrast rasterization functions. This serves to
40 * isolate the swrast module from the internals of the tnl module, and
41 * improve its usefulness as a fallback mechanism for hardware
44 * Full software drivers:
45 * - Register the rastersetup and triangle functions from
46 * utils/software_helper.
47 * - On statechange, update the rasterization pointers in that module.
49 * Rasterization hardware drivers:
50 * - Keep native rastersetup.
51 * - Implement native twoside,offset and unfilled triangle setup.
52 * - Implement a translator from native vertices to swrast vertices.
53 * - On partial fallback (mix of accelerated and unaccelerated
54 * prims), call a pass-through function which translates native
55 * vertices to SWvertices and calls the appropriate swrast function.
56 * - On total fallback (vertex format insufficient for state or all
57 * primitives unaccelerated), hook in swrast_setup instead.
61 GLfloat texcoord
[MAX_TEXTURE_UNITS
][4];
72 /* These are the public-access functions exported from swrast.
75 _swrast_alloc_buffers( GLcontext
*ctx
);
78 _swrast_CreateContext( GLcontext
*ctx
);
81 _swrast_DestroyContext( GLcontext
*ctx
);
86 _swrast_Bitmap( GLcontext
*ctx
,
88 GLsizei width
, GLsizei height
,
89 const struct gl_pixelstore_attrib
*unpack
,
90 const GLubyte
*bitmap
);
93 _swrast_CopyPixels( GLcontext
*ctx
,
94 GLint srcx
, GLint srcy
,
95 GLint destx
, GLint desty
,
96 GLsizei width
, GLsizei height
,
100 _swrast_DrawPixels( GLcontext
*ctx
,
102 GLsizei width
, GLsizei height
,
103 GLenum format
, GLenum type
,
104 const struct gl_pixelstore_attrib
*unpack
,
105 const GLvoid
*pixels
);
108 _swrast_ReadPixels( GLcontext
*ctx
,
109 GLint x
, GLint y
, GLsizei width
, GLsizei height
,
110 GLenum format
, GLenum type
,
111 const struct gl_pixelstore_attrib
*unpack
,
115 _swrast_Clear( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
116 GLint x
, GLint y
, GLint width
, GLint height
);
119 _swrast_Accum( GLcontext
*ctx
, GLenum op
,
120 GLfloat value
, GLint xpos
, GLint ypos
,
121 GLint width
, GLint height
);
124 /* Reset the stipple counter
127 _swrast_ResetLineStipple( GLcontext
*ctx
);
129 /* These will always render the correct point/line/triangle for the
132 * For flatshaded primitives, the provoking vertex is the final one.
135 _swrast_Point( GLcontext
*ctx
, const SWvertex
*v
);
138 _swrast_Line( GLcontext
*ctx
, const SWvertex
*v0
, const SWvertex
*v1
);
141 _swrast_Triangle( GLcontext
*ctx
, const SWvertex
*v0
,
142 const SWvertex
*v1
, const SWvertex
*v2
);
145 _swrast_Quad( GLcontext
*ctx
,
146 const SWvertex
*v0
, const SWvertex
*v1
,
147 const SWvertex
*v2
, const SWvertex
*v3
);
150 _swrast_flush( GLcontext
*ctx
);
153 /* Tell the software rasterizer about core state changes.
156 _swrast_InvalidateState( GLcontext
*ctx
, GLuint new_state
);
158 /* Configure software rasterizer to match hardware rasterizer characteristics:
161 _swrast_allow_vertex_fog( GLcontext
*ctx
, GLboolean value
);
164 _swrast_allow_pixel_fog( GLcontext
*ctx
, GLboolean value
);
169 _swrast_print_vertex( GLcontext
*ctx
, const SWvertex
*v
);