1 /*
2  * Mesa 3-D graphics library
3  *
4  * Copyright (c) 2011 VMware, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 
25 #ifndef FORMAT_PACK_H
26 #define FORMAT_PACK_H
27 
28 
29 #include "formats.h"
30 
31 
32 /** Pack a GLubyte rgba[4] color to dest address */
33 typedef void (*gl_pack_ubyte_rgba_func)(const GLubyte src[4], void *dst);
34 
35 /** Pack a GLfloat rgba[4] color to dest address */
36 typedef void (*gl_pack_float_rgba_func)(const GLfloat src[4], void *dst);
37 
38 /** Pack a GLfloat Z value to dest address */
39 typedef void (*gl_pack_float_z_func)(const GLfloat *src, void *dst);
40 
41 /** Pack a GLuint Z value to dest address */
42 typedef void (*gl_pack_uint_z_func)(const GLuint *src, void *dst);
43 
44 /** Pack a GLubyte stencil value to dest address */
45 typedef void (*gl_pack_ubyte_stencil_func)(const GLubyte *src, void *dst);
46 
47 
48 
49 
50 extern gl_pack_ubyte_rgba_func
51 _mesa_get_pack_ubyte_rgba_function(gl_format format);
52 
53 
54 extern gl_pack_float_rgba_func
55 _mesa_get_pack_float_rgba_function(gl_format format);
56 
57 
58 extern gl_pack_float_z_func
59 _mesa_get_pack_float_z_func(gl_format format);
60 
61 
62 extern gl_pack_uint_z_func
63 _mesa_get_pack_uint_z_func(gl_format format);
64 
65 
66 extern gl_pack_ubyte_stencil_func
67 _mesa_get_pack_ubyte_stencil_func(gl_format format);
68 
69 
70 
71 extern void
72 _mesa_pack_float_rgba_row(gl_format format, GLuint n,
73                           const GLfloat src[][4], void *dst);
74 
75 extern void
76 _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n,
77                           const GLubyte src[][4], void *dst);
78 
79 
80 extern void
81 _mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height,
82                            const GLubyte *src, GLint srcRowStride,
83                            void *dst, GLint dstRowStride);
84 
85 extern void
86 _mesa_pack_float_z_row(gl_format format, GLuint n,
87                        const GLfloat *src, void *dst);
88 
89 extern void
90 _mesa_pack_uint_z_row(gl_format format, GLuint n,
91                       const GLuint *src, void *dst);
92 
93 extern void
94 _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n,
95                              const GLubyte *src, void *dst);
96 
97 extern void
98 _mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n,
99                                        const GLuint *src, void *dst);
100 
101 
102 extern void
103 _mesa_pack_colormask(gl_format format, const GLubyte colorMask[4], void *dst);
104 
105 #endif
106