1/*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
5 * Copyright (C) 1999-2010  VMware, Inc.  All Rights Reserved.
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
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 * THE AUTHORS 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.
23 */
24
25
26#ifndef PACK_H
27#define PACK_H
28
29
30#include "mtypes.h"
31
32
33extern void
34_mesa_unpack_polygon_stipple(const GLubyte *pattern, GLuint dest[32],
35                             const struct gl_pixelstore_attrib *unpacking);
36
37
38extern void
39_mesa_pack_polygon_stipple(const GLuint pattern[32], GLubyte *dest,
40                           const struct gl_pixelstore_attrib *packing);
41
42
43extern GLvoid *
44_mesa_unpack_bitmap(GLint width, GLint height, const GLubyte *pixels,
45                    const struct gl_pixelstore_attrib *packing);
46
47extern void
48_mesa_pack_bitmap(GLint width, GLint height, const GLubyte *source,
49                  GLubyte *dest, const struct gl_pixelstore_attrib *packing);
50
51
52extern void
53_mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n,
54                           GLfloat rgba[][4],
55                           GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
56                           const struct gl_pixelstore_attrib *dstPacking,
57                           GLbitfield transferOps);
58
59
60extern void
61_mesa_unpack_color_span_ubyte(struct gl_context *ctx,
62                             GLuint n, GLenum dstFormat, GLubyte dest[],
63                             GLenum srcFormat, GLenum srcType,
64                             const GLvoid *source,
65                             const struct gl_pixelstore_attrib *srcPacking,
66                             GLbitfield transferOps);
67
68
69extern void
70_mesa_unpack_color_span_float(struct gl_context *ctx,
71                              GLuint n, GLenum dstFormat, GLfloat dest[],
72                              GLenum srcFormat, GLenum srcType,
73                              const GLvoid *source,
74                              const struct gl_pixelstore_attrib *srcPacking,
75                              GLbitfield transferOps);
76
77extern void
78_mesa_unpack_color_span_uint(struct gl_context *ctx,
79                             GLuint n, GLenum dstFormat, GLuint *dest,
80                             GLenum srcFormat, GLenum srcType,
81                             const GLvoid *source,
82                             const struct gl_pixelstore_attrib *srcPacking);
83
84extern void
85_mesa_unpack_dudv_span_byte(struct gl_context *ctx,
86                            GLuint n, GLenum dstFormat, GLbyte dest[],
87                            GLenum srcFormat, GLenum srcType,
88                            const GLvoid *source,
89                            const struct gl_pixelstore_attrib *srcPacking,
90                            GLbitfield transferOps);
91
92extern void
93_mesa_unpack_index_span(struct gl_context *ctx, GLuint n,
94                        GLenum dstType, GLvoid *dest,
95                        GLenum srcType, const GLvoid *source,
96                        const struct gl_pixelstore_attrib *srcPacking,
97                        GLbitfield transferOps);
98
99
100extern void
101_mesa_pack_index_span(struct gl_context *ctx, GLuint n,
102                      GLenum dstType, GLvoid *dest, const GLuint *source,
103                      const struct gl_pixelstore_attrib *dstPacking,
104                      GLbitfield transferOps);
105
106
107extern void
108_mesa_unpack_stencil_span(struct gl_context *ctx, GLuint n,
109                          GLenum dstType, GLvoid *dest,
110                          GLenum srcType, const GLvoid *source,
111                          const struct gl_pixelstore_attrib *srcPacking,
112                          GLbitfield transferOps);
113
114extern void
115_mesa_pack_stencil_span(struct gl_context *ctx, GLuint n,
116                        GLenum dstType, GLvoid *dest, const GLubyte *source,
117                        const struct gl_pixelstore_attrib *dstPacking);
118
119
120extern void
121_mesa_unpack_depth_span(struct gl_context *ctx, GLuint n,
122                        GLenum dstType, GLvoid *dest, GLuint depthMax,
123                        GLenum srcType, const GLvoid *source,
124                        const struct gl_pixelstore_attrib *srcPacking);
125
126extern void
127_mesa_pack_depth_span(struct gl_context *ctx, GLuint n, GLvoid *dest,
128                      GLenum dstType, const GLfloat *depthSpan,
129                      const struct gl_pixelstore_attrib *dstPacking);
130
131
132extern void
133_mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n,
134                              GLenum dstType, GLuint *dest,
135                              const GLfloat *depthVals,
136                              const GLubyte *stencilVals,
137                              const struct gl_pixelstore_attrib *dstPacking);
138
139
140extern void *
141_mesa_unpack_image(GLuint dimensions,
142                   GLsizei width, GLsizei height, GLsizei depth,
143                   GLenum format, GLenum type, const GLvoid *pixels,
144                   const struct gl_pixelstore_attrib *unpack);
145
146
147void
148_mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
149                                GLenum dstFormat, GLenum dstType,
150                                GLvoid *dstAddr);
151
152
153void
154_mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4],
155                               GLenum dstFormat, GLenum dstType,
156                               GLvoid *dstAddr);
157
158
159extern void
160_mesa_rebase_rgba_float(GLuint n, GLfloat rgba[][4], GLenum baseFormat);
161
162extern void
163_mesa_rebase_rgba_uint(GLuint n, GLuint rgba[][4], GLenum baseFormat);
164
165#endif
166