texstore.h revision d1b1b372704c93a0672b78be11fc5ea92b828c27
1/*
2 * Mesa 3-D graphics library
3 * Version:  6.3
4 *
5 * Copyright (C) 1999-2005  Brian Paul   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 * 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.
23 */
24
25
26/**
27 * \file texstore.h
28 * Texture image storage routines.
29 *
30 * \author Brian Paul
31 */
32
33
34#ifndef TEXSTORE_H
35#define TEXSTORE_H
36
37
38#include "mtypes.h"
39
40/* Macro just to save some typing */
41#define STORE_PARAMS \
42	GLcontext *ctx, GLuint dims, \
43	GLenum baseInternalFormat, \
44	const struct gl_texture_format *dstFormat, \
45	GLvoid *dstAddr, \
46	GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \
47	GLint dstRowStride, GLint dstImageStride, \
48	GLint srcWidth, GLint srcHeight, GLint srcDepth, \
49	GLenum srcFormat, GLenum srcType, \
50	const GLvoid *srcAddr, \
51	const struct gl_pixelstore_attrib *srcPacking
52
53
54extern GLboolean _mesa_texstore_rgba(STORE_PARAMS);
55extern GLboolean _mesa_texstore_color_index(STORE_PARAMS);
56extern GLboolean _mesa_texstore_depth_component16(STORE_PARAMS);
57extern GLboolean _mesa_texstore_depth_component_float32(STORE_PARAMS);
58extern GLboolean _mesa_texstore_rgba8888(STORE_PARAMS);
59extern GLboolean _mesa_texstore_argb8888(STORE_PARAMS);
60extern GLboolean _mesa_texstore_rgb888(STORE_PARAMS);
61extern GLboolean _mesa_texstore_bgr888(STORE_PARAMS);
62extern GLboolean _mesa_texstore_rgb565(STORE_PARAMS);
63extern GLboolean _mesa_texstore_rgb565_rev(STORE_PARAMS);
64extern GLboolean _mesa_texstore_argb4444(STORE_PARAMS);
65extern GLboolean _mesa_texstore_argb4444_rev(STORE_PARAMS);
66extern GLboolean _mesa_texstore_argb1555(STORE_PARAMS);
67extern GLboolean _mesa_texstore_argb1555_rev(STORE_PARAMS);
68extern GLboolean _mesa_texstore_al88(STORE_PARAMS);
69extern GLboolean _mesa_texstore_al88_rev(STORE_PARAMS);
70extern GLboolean _mesa_texstore_rgb332(STORE_PARAMS);
71extern GLboolean _mesa_texstore_a8(STORE_PARAMS);
72extern GLboolean _mesa_texstore_ci8(STORE_PARAMS);
73extern GLboolean _mesa_texstore_ycbcr(STORE_PARAMS);
74extern GLboolean _mesa_texstore_rgba_float32(STORE_PARAMS);
75extern GLboolean _mesa_texstore_rgba_float16(STORE_PARAMS);
76extern GLboolean _mesa_texstore_rgb_fxt1(STORE_PARAMS);
77extern GLboolean _mesa_texstore_rgba_fxt1(STORE_PARAMS);
78extern GLboolean _mesa_texstore_rgb_dxt1(STORE_PARAMS);
79extern GLboolean _mesa_texstore_rgba_dxt1(STORE_PARAMS);
80extern GLboolean _mesa_texstore_rgba_dxt3(STORE_PARAMS);
81extern GLboolean _mesa_texstore_rgba_dxt5(STORE_PARAMS);
82
83
84extern GLchan *
85_mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
86                           GLenum logicalBaseFormat,
87                           GLenum textureBaseFormat,
88                           GLint srcWidth, GLint srcHeight, GLint srcDepth,
89                           GLenum srcFormat, GLenum srcType,
90                           const GLvoid *srcAddr,
91                           const struct gl_pixelstore_attrib *srcPacking);
92
93
94extern void
95_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
96                       GLint internalFormat,
97                       GLint width, GLint border,
98                       GLenum format, GLenum type, const GLvoid *pixels,
99                       const struct gl_pixelstore_attrib *packing,
100                       struct gl_texture_object *texObj,
101                       struct gl_texture_image *texImage);
102
103
104extern void
105_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
106                       GLint internalFormat,
107                       GLint width, GLint height, GLint border,
108                       GLenum format, GLenum type, const GLvoid *pixels,
109                       const struct gl_pixelstore_attrib *packing,
110                       struct gl_texture_object *texObj,
111                       struct gl_texture_image *texImage);
112
113
114extern void
115_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
116                       GLint internalFormat,
117                       GLint width, GLint height, GLint depth, GLint border,
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
124extern void
125_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
126                          GLint xoffset, GLint width,
127                          GLenum format, GLenum type, const GLvoid *pixels,
128                          const struct gl_pixelstore_attrib *packing,
129                          struct gl_texture_object *texObj,
130                          struct gl_texture_image *texImage);
131
132
133extern void
134_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
135                          GLint xoffset, GLint yoffset,
136                          GLint width, GLint height,
137                          GLenum format, GLenum type, const GLvoid *pixels,
138                          const struct gl_pixelstore_attrib *packing,
139                          struct gl_texture_object *texObj,
140                          struct gl_texture_image *texImage);
141
142
143extern void
144_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
145                          GLint xoffset, GLint yoffset, GLint zoffset,
146                          GLint width, GLint height, GLint depth,
147                          GLenum format, GLenum type, const GLvoid *pixels,
148                          const struct gl_pixelstore_attrib *packing,
149                          struct gl_texture_object *texObj,
150                          struct gl_texture_image *texImage);
151
152
153extern void
154_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
155                                  GLint internalFormat,
156                                  GLint width, GLint border,
157                                  GLsizei imageSize, const GLvoid *data,
158                                  struct gl_texture_object *texObj,
159                                  struct gl_texture_image *texImage);
160
161extern void
162_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
163                                  GLint internalFormat,
164                                  GLint width, GLint height, GLint border,
165                                  GLsizei imageSize, const GLvoid *data,
166                                  struct gl_texture_object *texObj,
167                                  struct gl_texture_image *texImage);
168
169extern void
170_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
171                                  GLint internalFormat,
172                                  GLint width, GLint height, GLint depth,
173                                  GLint border,
174                                  GLsizei imageSize, const GLvoid *data,
175                                  struct gl_texture_object *texObj,
176                                  struct gl_texture_image *texImage);
177
178
179extern void
180_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
181                                     GLint level,
182                                     GLint xoffset, GLsizei width,
183                                     GLenum format,
184                                     GLsizei imageSize, const GLvoid *data,
185                                     struct gl_texture_object *texObj,
186                                     struct gl_texture_image *texImage);
187
188extern void
189_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
190                                     GLint level,
191                                     GLint xoffset, GLint yoffset,
192                                     GLsizei width, GLsizei height,
193                                     GLenum format,
194                                     GLsizei imageSize, const GLvoid *data,
195                                     struct gl_texture_object *texObj,
196                                     struct gl_texture_image *texImage);
197
198extern void
199_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
200                                GLint level,
201                                GLint xoffset, GLint yoffset, GLint zoffset,
202                                GLsizei width, GLsizei height, GLsizei depth,
203                                GLenum format,
204                                GLsizei imageSize, const GLvoid *data,
205                                struct gl_texture_object *texObj,
206                                struct gl_texture_image *texImage);
207
208
209extern void
210_mesa_generate_mipmap(GLcontext *ctx, GLenum target,
211                      const struct gl_texture_unit *texUnit,
212                      struct gl_texture_object *texObj);
213
214
215extern void
216_mesa_rescale_teximage2d(GLuint bytesPerPixel,
217                         GLuint srcStrideInPixels,
218                         GLuint dstRowStride,
219                         GLint srcWidth, GLint srcHeight,
220                         GLint dstWidth, GLint dstHeight,
221                         const GLvoid *srcImage, GLvoid *dstImage);
222
223extern void
224_mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
225                         GLsizei outWidth, GLsizei outHeight,
226                         GLint comps, const GLchan *src, GLint srcRowStride,
227                         GLchan *dest);
228
229
230extern void
231_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
232                   GLenum format, GLenum type, GLvoid *pixels,
233                   const struct gl_texture_object *texObj,
234                   const struct gl_texture_image *texImage);
235
236
237extern void
238_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
239                              GLvoid *img,
240                              const struct gl_texture_object *texObj,
241                              const struct gl_texture_image *texImage);
242
243extern const GLvoid *
244_mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions,
245			    GLsizei width, GLsizei height, GLsizei depth,
246			    GLenum format, GLenum type, const GLvoid *pixels,
247			    const struct gl_pixelstore_attrib *unpack,
248			    const char *funcName);
249
250extern const GLvoid *
251_mesa_validate_pbo_compressed_teximage(GLcontext *ctx,
252                                    GLsizei imageSize, const GLvoid *pixels,
253                                    const struct gl_pixelstore_attrib *packing,
254                                    const char *funcName);
255
256extern void
257_mesa_unmap_teximage_pbo(GLcontext *ctx,
258                         const struct gl_pixelstore_attrib *unpack);
259
260
261#endif
262