mesa: refactor: move glReadPixels code into new readpix.c file
[mesa.git] / src / mesa / main / teximage.h
1 /**
2 * \file teximage.h
3 * Texture images manipulation functions.
4 */
5
6 /*
7 * Mesa 3-D graphics library
8 * Version: 6.5
9 *
10 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30
31 #ifndef TEXIMAGE_H
32 #define TEXIMAGE_H
33
34
35 #include "mtypes.h"
36
37
38 extern void *
39 _mesa_alloc_texmemory(GLsizei bytes);
40
41 extern void
42 _mesa_free_texmemory(void *m);
43
44
45 /** \name Internal functions */
46 /*@{*/
47
48 extern GLint
49 _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat );
50
51
52 extern GLboolean
53 _mesa_is_proxy_texture(GLenum target);
54
55
56 extern struct gl_texture_image *
57 _mesa_new_texture_image( GLcontext *ctx );
58
59
60 extern void
61 _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *teximage );
62
63 extern void
64 _mesa_free_texture_image_data( GLcontext *ctx,
65 struct gl_texture_image *texImage );
66
67
68 extern void
69 _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
70 struct gl_texture_image *img,
71 GLsizei width, GLsizei height, GLsizei depth,
72 GLint border, GLenum internalFormat);
73
74
75 extern void
76 _mesa_set_tex_image(struct gl_texture_object *tObj,
77 GLenum target, GLint level,
78 struct gl_texture_image *texImage);
79
80
81 extern struct gl_texture_object *
82 _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
83 GLenum target);
84
85
86 extern struct gl_texture_image *
87 _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj,
88 GLenum target, GLint level);
89
90
91 extern struct gl_texture_image *
92 _mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj,
93 GLenum target, GLint level);
94
95
96 extern struct gl_texture_image *
97 _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level);
98
99
100 extern GLint
101 _mesa_max_texture_levels(GLcontext *ctx, GLenum target);
102
103
104 extern GLboolean
105 _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
106 GLint internalFormat, GLenum format, GLenum type,
107 GLint width, GLint height, GLint depth, GLint border);
108
109
110 /**
111 * Lock a texture for updating. See also _mesa_lock_context_textures().
112 */
113 static INLINE void
114 _mesa_lock_texture(GLcontext *ctx, struct gl_texture_object *texObj)
115 {
116 _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
117 ctx->Shared->TextureStateStamp++;
118 (void) texObj;
119 }
120
121 static INLINE void
122 _mesa_unlock_texture(GLcontext *ctx, struct gl_texture_object *texObj)
123 {
124 _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
125 }
126
127 /*@}*/
128
129
130 /** \name API entry point functions */
131 /*@{*/
132
133 extern void GLAPIENTRY
134 _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
135 GLsizei width, GLint border,
136 GLenum format, GLenum type, const GLvoid *pixels );
137
138
139 extern void GLAPIENTRY
140 _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
141 GLsizei width, GLsizei height, GLint border,
142 GLenum format, GLenum type, const GLvoid *pixels );
143
144
145 extern void GLAPIENTRY
146 _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
147 GLsizei width, GLsizei height, GLsizei depth, GLint border,
148 GLenum format, GLenum type, const GLvoid *pixels );
149
150
151 extern void GLAPIENTRY
152 _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
153 GLsizei width, GLsizei height, GLsizei depth,
154 GLint border, GLenum format, GLenum type,
155 const GLvoid *pixels );
156
157
158 extern void GLAPIENTRY
159 _mesa_GetTexImage( GLenum target, GLint level,
160 GLenum format, GLenum type, GLvoid *pixels );
161
162
163 extern void GLAPIENTRY
164 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
165 GLsizei width,
166 GLenum format, GLenum type,
167 const GLvoid *pixels );
168
169
170 extern void GLAPIENTRY
171 _mesa_TexSubImage2D( GLenum target, GLint level,
172 GLint xoffset, GLint yoffset,
173 GLsizei width, GLsizei height,
174 GLenum format, GLenum type,
175 const GLvoid *pixels );
176
177
178 extern void GLAPIENTRY
179 _mesa_TexSubImage3D( GLenum target, GLint level,
180 GLint xoffset, GLint yoffset, GLint zoffset,
181 GLsizei width, GLsizei height, GLsizei depth,
182 GLenum format, GLenum type,
183 const GLvoid *pixels );
184
185
186 extern void GLAPIENTRY
187 _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
188 GLint x, GLint y, GLsizei width, GLint border );
189
190
191 extern void GLAPIENTRY
192 _mesa_CopyTexImage2D( GLenum target, GLint level,
193 GLenum internalformat, GLint x, GLint y,
194 GLsizei width, GLsizei height, GLint border );
195
196
197 extern void GLAPIENTRY
198 _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
199 GLint x, GLint y, GLsizei width );
200
201
202 extern void GLAPIENTRY
203 _mesa_CopyTexSubImage2D( GLenum target, GLint level,
204 GLint xoffset, GLint yoffset,
205 GLint x, GLint y, GLsizei width, GLsizei height );
206
207
208 extern void GLAPIENTRY
209 _mesa_CopyTexSubImage3D( GLenum target, GLint level,
210 GLint xoffset, GLint yoffset, GLint zoffset,
211 GLint x, GLint y, GLsizei width, GLsizei height );
212
213
214
215 extern void GLAPIENTRY
216 _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
217 GLenum internalformat, GLsizei width,
218 GLint border, GLsizei imageSize,
219 const GLvoid *data);
220
221 extern void GLAPIENTRY
222 _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
223 GLenum internalformat, GLsizei width,
224 GLsizei height, GLint border, GLsizei imageSize,
225 const GLvoid *data);
226
227 extern void GLAPIENTRY
228 _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
229 GLenum internalformat, GLsizei width,
230 GLsizei height, GLsizei depth, GLint border,
231 GLsizei imageSize, const GLvoid *data);
232
233 #ifdef VMS
234 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
235 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
236 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
237 #endif
238 extern void GLAPIENTRY
239 _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
240 GLsizei width, GLenum format,
241 GLsizei imageSize, const GLvoid *data);
242
243 extern void GLAPIENTRY
244 _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
245 GLint yoffset, GLsizei width, GLsizei height,
246 GLenum format, GLsizei imageSize,
247 const GLvoid *data);
248
249 extern void GLAPIENTRY
250 _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
251 GLint yoffset, GLint zoffset, GLsizei width,
252 GLsizei height, GLsizei depth, GLenum format,
253 GLsizei imageSize, const GLvoid *data);
254
255 extern void GLAPIENTRY
256 _mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img);
257
258 /*@}*/
259
260 #endif