Merge branch 'mesa_7_6_branch' into mesa_7_7_branch
[profile/ivi/mesa.git] / src / mesa / main / texstore.h
1 /*
2  * Mesa 3-D graphics library
3  * Version:  6.5.1
4  *
5  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
6  * Copyright (c) 2008 VMware, Inc.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25
26
27 /**
28  * \file texstore.h
29  * Texture image storage routines.
30  *
31  * \author Brian Paul
32  */
33
34
35 #ifndef TEXSTORE_H
36 #define TEXSTORE_H
37
38
39 #include "mtypes.h"
40 #include "formats.h"
41
42
43 /**
44  * This macro defines the (many) parameters to the texstore functions.
45  * \param dims  either 1 or 2 or 3
46  * \param baseInternalFormat  user-specified base internal format
47  * \param dstFormat  destination Mesa texture format
48  * \param dstAddr  destination image address
49  * \param dstX/Y/Zoffset  destination x/y/z offset (ala TexSubImage), in texels
50  * \param dstRowStride  destination image row stride, in bytes
51  * \param dstImageOffsets  offset of each 2D slice within 3D texture, in texels
52  * \param srcWidth/Height/Depth  source image size, in pixels
53  * \param srcFormat  incoming image format
54  * \param srcType  incoming image data type
55  * \param srcAddr  source image address
56  * \param srcPacking  source image packing parameters
57  */
58 #define TEXSTORE_PARAMS \
59         GLcontext *ctx, GLuint dims, \
60         GLenum baseInternalFormat, \
61         gl_format dstFormat, \
62         GLvoid *dstAddr, \
63         GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
64         GLint dstRowStride, const GLuint *dstImageOffsets, \
65         GLint srcWidth, GLint srcHeight, GLint srcDepth, \
66         GLenum srcFormat, GLenum srcType, \
67         const GLvoid *srcAddr, \
68         const struct gl_pixelstore_attrib *srcPacking
69
70
71 extern GLboolean
72 _mesa_texstore(TEXSTORE_PARAMS);
73
74
75 extern GLchan *
76 _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
77                            GLenum logicalBaseFormat,
78                            GLenum textureBaseFormat,
79                            GLint srcWidth, GLint srcHeight, GLint srcDepth,
80                            GLenum srcFormat, GLenum srcType,
81                            const GLvoid *srcAddr,
82                            const struct gl_pixelstore_attrib *srcPacking);
83
84
85 extern void
86 _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
87                        GLint internalFormat,
88                        GLint width, GLint border,
89                        GLenum format, GLenum type, const GLvoid *pixels,
90                        const struct gl_pixelstore_attrib *packing,
91                        struct gl_texture_object *texObj,
92                        struct gl_texture_image *texImage);
93
94
95 extern void
96 _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
97                        GLint internalFormat,
98                        GLint width, GLint height, GLint border,
99                        GLenum format, GLenum type, const GLvoid *pixels,
100                        const struct gl_pixelstore_attrib *packing,
101                        struct gl_texture_object *texObj,
102                        struct gl_texture_image *texImage);
103
104
105 extern void
106 _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
107                        GLint internalFormat,
108                        GLint width, GLint height, GLint depth, GLint border,
109                        GLenum format, GLenum type, const GLvoid *pixels,
110                        const struct gl_pixelstore_attrib *packing,
111                        struct gl_texture_object *texObj,
112                        struct gl_texture_image *texImage);
113
114
115 extern void
116 _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
117                           GLint xoffset, GLint width,
118                           GLenum format, GLenum type, const GLvoid *pixels,
119                           const struct gl_pixelstore_attrib *packing,
120                           struct gl_texture_object *texObj,
121                           struct gl_texture_image *texImage);
122
123
124 extern void
125 _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
126                           GLint xoffset, GLint yoffset,
127                           GLint width, GLint height,
128                           GLenum format, GLenum type, const GLvoid *pixels,
129                           const struct gl_pixelstore_attrib *packing,
130                           struct gl_texture_object *texObj,
131                           struct gl_texture_image *texImage);
132
133
134 extern void
135 _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
136                           GLint xoffset, GLint yoffset, GLint zoffset,
137                           GLint width, GLint height, GLint depth,
138                           GLenum format, GLenum type, const GLvoid *pixels,
139                           const struct gl_pixelstore_attrib *packing,
140                           struct gl_texture_object *texObj,
141                           struct gl_texture_image *texImage);
142
143
144 extern void
145 _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
146                                   GLint internalFormat,
147                                   GLint width, GLint border,
148                                   GLsizei imageSize, const GLvoid *data,
149                                   struct gl_texture_object *texObj,
150                                   struct gl_texture_image *texImage);
151
152 extern void
153 _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
154                                   GLint internalFormat,
155                                   GLint width, GLint height, GLint border,
156                                   GLsizei imageSize, const GLvoid *data,
157                                   struct gl_texture_object *texObj,
158                                   struct gl_texture_image *texImage);
159
160 extern void
161 _mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
162                                   GLint internalFormat,
163                                   GLint width, GLint height, GLint depth,
164                                   GLint border,
165                                   GLsizei imageSize, const GLvoid *data,
166                                   struct gl_texture_object *texObj,
167                                   struct gl_texture_image *texImage);
168
169
170 extern void
171 _mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
172                                      GLint level,
173                                      GLint xoffset, GLsizei width,
174                                      GLenum format,
175                                      GLsizei imageSize, const GLvoid *data,
176                                      struct gl_texture_object *texObj,
177                                      struct gl_texture_image *texImage);
178
179 extern void
180 _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
181                                      GLint level,
182                                      GLint xoffset, GLint yoffset,
183                                      GLsizei width, GLsizei height,
184                                      GLenum format,
185                                      GLsizei imageSize, const GLvoid *data,
186                                      struct gl_texture_object *texObj,
187                                      struct gl_texture_image *texImage);
188
189 extern void
190 _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
191                                 GLint level,
192                                 GLint xoffset, GLint yoffset, GLint zoffset,
193                                 GLsizei width, GLsizei height, GLsizei depth,
194                                 GLenum format,
195                                 GLsizei imageSize, const GLvoid *data,
196                                 struct gl_texture_object *texObj,
197                                 struct gl_texture_image *texImage);
198
199
200 extern const GLvoid *
201 _mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions,
202                             GLsizei width, GLsizei height, GLsizei depth,
203                             GLenum format, GLenum type, const GLvoid *pixels,
204                             const struct gl_pixelstore_attrib *unpack,
205                             const char *funcName);
206
207 extern const GLvoid *
208 _mesa_validate_pbo_compressed_teximage(GLcontext *ctx,
209                                     GLsizei imageSize, const GLvoid *pixels,
210                                     const struct gl_pixelstore_attrib *packing,
211                                     const char *funcName);
212
213 extern void
214 _mesa_unmap_teximage_pbo(GLcontext *ctx,
215                          const struct gl_pixelstore_attrib *unpack);
216
217
218 #endif