2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 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.
34 _mesa_swap2( GLushort
*p
, GLuint n
);
37 _mesa_swap4( GLuint
*p
, GLuint n
);
40 _mesa_type_is_packed(GLenum type
);
43 _mesa_sizeof_type( GLenum type
);
46 _mesa_sizeof_packed_type( GLenum type
);
49 _mesa_components_in_format( GLenum format
);
52 _mesa_bytes_per_pixel( GLenum format
, GLenum type
);
55 _mesa_is_legal_format_and_type( GLcontext
*ctx
, GLenum format
, GLenum type
);
58 _mesa_is_color_format(GLenum format
);
61 _mesa_is_index_format(GLenum format
);
64 _mesa_is_depth_format(GLenum format
);
67 _mesa_is_ycbcr_format(GLenum format
);
70 _mesa_is_depthstencil_format(GLenum format
);
73 _mesa_is_dudv_format(GLenum format
);
77 _mesa_image_address( GLuint dimensions
,
78 const struct gl_pixelstore_attrib
*packing
,
80 GLsizei width
, GLsizei height
,
81 GLenum format
, GLenum type
,
82 GLint img
, GLint row
, GLint column
);
85 _mesa_image_address1d( const struct gl_pixelstore_attrib
*packing
,
88 GLenum format
, GLenum type
,
92 _mesa_image_address2d( const struct gl_pixelstore_attrib
*packing
,
94 GLsizei width
, GLsizei height
,
95 GLenum format
, GLenum type
,
96 GLint row
, GLint column
);
99 _mesa_image_address3d( const struct gl_pixelstore_attrib
*packing
,
101 GLsizei width
, GLsizei height
,
102 GLenum format
, GLenum type
,
103 GLint img
, GLint row
, GLint column
);
107 _mesa_image_row_stride( const struct gl_pixelstore_attrib
*packing
,
108 GLint width
, GLenum format
, GLenum type
);
112 _mesa_image_image_stride( const struct gl_pixelstore_attrib
*packing
,
113 GLint width
, GLint height
,
114 GLenum format
, GLenum type
);
117 _mesa_unpack_polygon_stipple( const GLubyte
*pattern
, GLuint dest
[32],
118 const struct gl_pixelstore_attrib
*unpacking
);
122 _mesa_pack_polygon_stipple( const GLuint pattern
[32], GLubyte
*dest
,
123 const struct gl_pixelstore_attrib
*packing
);
127 _mesa_unpack_bitmap( GLint width
, GLint height
, const GLubyte
*pixels
,
128 const struct gl_pixelstore_attrib
*packing
);
131 _mesa_pack_bitmap( GLint width
, GLint height
, const GLubyte
*source
,
132 GLubyte
*dest
, const struct gl_pixelstore_attrib
*packing
);
135 /** \name Pixel processing functions */
139 _mesa_scale_and_bias_rgba(GLuint n
, GLfloat rgba
[][4],
140 GLfloat rScale
, GLfloat gScale
,
141 GLfloat bScale
, GLfloat aScale
,
142 GLfloat rBias
, GLfloat gBias
,
143 GLfloat bBias
, GLfloat aBias
);
146 _mesa_map_rgba(const GLcontext
*ctx
, GLuint n
, GLfloat rgba
[][4]);
150 _mesa_transform_rgba(const GLcontext
*ctx
, GLuint n
, GLfloat rgba
[][4]);
154 _mesa_lookup_rgba_float(const struct gl_color_table
*table
,
155 GLuint n
, GLfloat rgba
[][4]);
158 _mesa_lookup_rgba_ubyte(const struct gl_color_table
*table
,
159 GLuint n
, GLubyte rgba
[][4]);
163 _mesa_map_ci_to_rgba(const GLcontext
*ctx
,
164 GLuint n
, const GLuint index
[], GLfloat rgba
[][4]);
168 _mesa_map_ci8_to_rgba8(const GLcontext
*ctx
, GLuint n
, const GLubyte index
[],
173 _mesa_scale_and_bias_depth(const GLcontext
*ctx
, GLuint n
,
174 GLfloat depthValues
[]);
177 _mesa_scale_and_bias_depth_uint(const GLcontext
*ctx
, GLuint n
,
178 GLuint depthValues
[]);
181 _mesa_apply_rgba_transfer_ops(GLcontext
*ctx
, GLbitfield transferOps
,
182 GLuint n
, GLfloat rgba
[][4]);
186 _mesa_apply_ci_transfer_ops(const GLcontext
*ctx
, GLbitfield transferOps
,
187 GLuint n
, GLuint indexes
[]);
191 _mesa_apply_stencil_transfer_ops(const GLcontext
*ctx
, GLuint n
,
192 GLstencil stencil
[]);
196 _mesa_pack_rgba_span_float( GLcontext
*ctx
, GLuint n
, GLfloat rgba
[][4],
197 GLenum dstFormat
, GLenum dstType
, GLvoid
*dstAddr
,
198 const struct gl_pixelstore_attrib
*dstPacking
,
199 GLbitfield transferOps
);
203 _mesa_unpack_color_span_chan( GLcontext
*ctx
,
204 GLuint n
, GLenum dstFormat
, GLchan dest
[],
205 GLenum srcFormat
, GLenum srcType
,
206 const GLvoid
*source
,
207 const struct gl_pixelstore_attrib
*srcPacking
,
208 GLbitfield transferOps
);
212 _mesa_unpack_color_span_float( GLcontext
*ctx
,
213 GLuint n
, GLenum dstFormat
, GLfloat dest
[],
214 GLenum srcFormat
, GLenum srcType
,
215 const GLvoid
*source
,
216 const struct gl_pixelstore_attrib
*srcPacking
,
217 GLbitfield transferOps
);
220 _mesa_unpack_dudv_span_byte( GLcontext
*ctx
,
221 GLuint n
, GLenum dstFormat
, GLbyte dest
[],
222 GLenum srcFormat
, GLenum srcType
,
223 const GLvoid
*source
,
224 const struct gl_pixelstore_attrib
*srcPacking
,
225 GLbitfield transferOps
);
228 _mesa_unpack_index_span( const GLcontext
*ctx
, GLuint n
,
229 GLenum dstType
, GLvoid
*dest
,
230 GLenum srcType
, const GLvoid
*source
,
231 const struct gl_pixelstore_attrib
*srcPacking
,
232 GLbitfield transferOps
);
236 _mesa_pack_index_span( const GLcontext
*ctx
, GLuint n
,
237 GLenum dstType
, GLvoid
*dest
, const GLuint
*source
,
238 const struct gl_pixelstore_attrib
*dstPacking
,
239 GLbitfield transferOps
);
243 _mesa_unpack_stencil_span( const GLcontext
*ctx
, GLuint n
,
244 GLenum dstType
, GLvoid
*dest
,
245 GLenum srcType
, const GLvoid
*source
,
246 const struct gl_pixelstore_attrib
*srcPacking
,
247 GLbitfield transferOps
);
250 _mesa_pack_stencil_span( const GLcontext
*ctx
, GLuint n
,
251 GLenum dstType
, GLvoid
*dest
, const GLstencil
*source
,
252 const struct gl_pixelstore_attrib
*dstPacking
);
256 _mesa_unpack_depth_span( const GLcontext
*ctx
, GLuint n
,
257 GLenum dstType
, GLvoid
*dest
, GLuint depthMax
,
258 GLenum srcType
, const GLvoid
*source
,
259 const struct gl_pixelstore_attrib
*srcPacking
);
262 _mesa_pack_depth_span( const GLcontext
*ctx
, GLuint n
, GLvoid
*dest
,
263 GLenum dstType
, const GLfloat
*depthSpan
,
264 const struct gl_pixelstore_attrib
*dstPacking
);
268 _mesa_pack_depth_stencil_span(const GLcontext
*ctx
, GLuint n
, GLuint
*dest
,
269 const GLfloat
*depthVals
,
270 const GLstencil
*stencilVals
,
271 const struct gl_pixelstore_attrib
*dstPacking
);
275 _mesa_unpack_image( GLuint dimensions
,
276 GLsizei width
, GLsizei height
, GLsizei depth
,
277 GLenum format
, GLenum type
, const GLvoid
*pixels
,
278 const struct gl_pixelstore_attrib
*unpack
);
282 _mesa_convert_colors(GLenum srcType
, const GLvoid
*src
,
283 GLenum dstType
, GLvoid
*dst
,
284 GLuint count
, const GLubyte mask
[]);
288 _mesa_clip_drawpixels(const GLcontext
*ctx
,
289 GLint
*destX
, GLint
*destY
,
290 GLsizei
*width
, GLsizei
*height
,
291 struct gl_pixelstore_attrib
*unpack
);
295 _mesa_clip_readpixels(const GLcontext
*ctx
,
296 GLint
*destX
, GLint
*destY
,
297 GLsizei
*width
, GLsizei
*height
,
298 struct gl_pixelstore_attrib
*pack
);
301 _mesa_clip_copytexsubimage(const GLcontext
*ctx
,
302 GLint
*destX
, GLint
*destY
,
303 GLint
*srcX
, GLint
*srcY
,
304 GLsizei
*width
, GLsizei
*height
);
307 _mesa_clip_to_region(GLint xmin
, GLint ymin
,
308 GLint xmax
, GLint ymax
,
310 GLsizei
*width
, GLsizei
*height
);
313 _mesa_clip_blit(GLcontext
*ctx
,
314 GLint
*srcX0
, GLint
*srcY0
, GLint
*srcX1
, GLint
*srcY1
,
315 GLint
*dstX0
, GLint
*dstY0
, GLint
*dstX1
, GLint
*dstY1
);