Consistent copyright info (version number, date) across all files.
[mesa.git] / src / mesa / swrast / swrast.h
1 /* $Id: swrast.h,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 *
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:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
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.
25 *
26 * Authors:
27 * Keith Whitwell <keithw@valinux.com>
28 */
29
30 #ifndef SWRAST_H
31 #define SWRAST_H
32
33 #include "mtypes.h"
34
35
36
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
42 * drivers.
43 *
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.
48 *
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.
58 */
59 typedef struct {
60 GLfloat win[4];
61 GLfloat texcoord[MAX_TEXTURE_UNITS][4];
62 GLchan color[4];
63 GLchan specular[4];
64 GLfloat fog;
65 GLuint index;
66 GLfloat pointSize;
67 } SWvertex;
68
69
70
71
72 /* These are the public-access functions exported from swrast.
73 */
74 extern void
75 _swrast_alloc_buffers( GLcontext *ctx );
76
77 extern GLboolean
78 _swrast_CreateContext( GLcontext *ctx );
79
80 extern void
81 _swrast_DestroyContext( GLcontext *ctx );
82
83
84
85 extern void
86 _swrast_Bitmap( GLcontext *ctx,
87 GLint px, GLint py,
88 GLsizei width, GLsizei height,
89 const struct gl_pixelstore_attrib *unpack,
90 const GLubyte *bitmap );
91
92 extern void
93 _swrast_CopyPixels( GLcontext *ctx,
94 GLint srcx, GLint srcy,
95 GLint destx, GLint desty,
96 GLsizei width, GLsizei height,
97 GLenum type );
98
99 extern void
100 _swrast_DrawPixels( GLcontext *ctx,
101 GLint x, GLint y,
102 GLsizei width, GLsizei height,
103 GLenum format, GLenum type,
104 const struct gl_pixelstore_attrib *unpack,
105 const GLvoid *pixels );
106
107 extern void
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,
112 GLvoid *pixels );
113
114 extern void
115 _swrast_Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
116 GLint x, GLint y, GLint width, GLint height );
117
118 extern void
119 _swrast_Accum( GLcontext *ctx, GLenum op,
120 GLfloat value, GLint xpos, GLint ypos,
121 GLint width, GLint height );
122
123
124 /* Reset the stipple counter
125 */
126 extern void
127 _swrast_ResetLineStipple( GLcontext *ctx );
128
129 /* These will always render the correct point/line/triangle for the
130 * current state.
131 *
132 * For flatshaded primitives, the provoking vertex is the final one.
133 */
134 extern void
135 _swrast_Point( GLcontext *ctx, const SWvertex *v );
136
137 extern void
138 _swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 );
139
140 extern void
141 _swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
142 const SWvertex *v1, const SWvertex *v2 );
143
144 extern void
145 _swrast_Quad( GLcontext *ctx,
146 const SWvertex *v0, const SWvertex *v1,
147 const SWvertex *v2, const SWvertex *v3);
148
149 extern void
150 _swrast_flush( GLcontext *ctx );
151
152
153 /* Tell the software rasterizer about core state changes.
154 */
155 extern void
156 _swrast_InvalidateState( GLcontext *ctx, GLuint new_state );
157
158 /* Configure software rasterizer to match hardware rasterizer characteristics:
159 */
160 extern void
161 _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value );
162
163 extern void
164 _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
165
166 /* Debug:
167 */
168 extern void
169 _swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
170
171 #endif