Merge remote branch 'origin/master' into pipe-video
[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_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage);
77
78
79 extern void
80 _mesa_set_tex_image(struct gl_texture_object *tObj,
81 GLenum target, GLint level,
82 struct gl_texture_image *texImage);
83
84
85 extern struct gl_texture_object *
86 _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
87 GLenum target);
88
89 extern struct gl_texture_object *
90 _mesa_get_current_tex_object(GLcontext *ctx, GLenum target);
91
92
93 extern struct gl_texture_image *
94 _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj,
95 GLenum target, GLint level);
96
97
98 extern struct gl_texture_image *
99 _mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj,
100 GLenum target, GLint level);
101
102
103 extern struct gl_texture_image *
104 _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level);
105
106
107 extern GLint
108 _mesa_max_texture_levels(GLcontext *ctx, GLenum target);
109
110
111 extern GLboolean
112 _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
113 GLint internalFormat, GLenum format, GLenum type,
114 GLint width, GLint height, GLint depth, GLint border);
115
116
117 extern GLuint
118 _mesa_tex_target_to_face(GLenum target);
119
120
121 /**
122 * Lock a texture for updating. See also _mesa_lock_context_textures().
123 */
124 static INLINE void
125 _mesa_lock_texture(GLcontext *ctx, struct gl_texture_object *texObj)
126 {
127 _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
128 ctx->Shared->TextureStateStamp++;
129 (void) texObj;
130 }
131
132 static INLINE void
133 _mesa_unlock_texture(GLcontext *ctx, struct gl_texture_object *texObj)
134 {
135 _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
136 }
137
138 /*@}*/
139
140
141 /** \name API entry point functions */
142 /*@{*/
143
144 extern void GLAPIENTRY
145 _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
146 GLsizei width, GLint border,
147 GLenum format, GLenum type, const GLvoid *pixels );
148
149
150 extern void GLAPIENTRY
151 _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
152 GLsizei width, GLsizei height, GLint border,
153 GLenum format, GLenum type, const GLvoid *pixels );
154
155
156 extern void GLAPIENTRY
157 _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
158 GLsizei width, GLsizei height, GLsizei depth, GLint border,
159 GLenum format, GLenum type, const GLvoid *pixels );
160
161
162 extern void GLAPIENTRY
163 _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
164 GLsizei width, GLsizei height, GLsizei depth,
165 GLint border, GLenum format, GLenum type,
166 const GLvoid *pixels );
167
168 extern void GLAPIENTRY
169 _mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
170
171 extern void GLAPIENTRY
172 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
173 GLsizei width,
174 GLenum format, GLenum type,
175 const GLvoid *pixels );
176
177
178 extern void GLAPIENTRY
179 _mesa_TexSubImage2D( GLenum target, GLint level,
180 GLint xoffset, GLint yoffset,
181 GLsizei width, GLsizei height,
182 GLenum format, GLenum type,
183 const GLvoid *pixels );
184
185
186 extern void GLAPIENTRY
187 _mesa_TexSubImage3D( GLenum target, GLint level,
188 GLint xoffset, GLint yoffset, GLint zoffset,
189 GLsizei width, GLsizei height, GLsizei depth,
190 GLenum format, GLenum type,
191 const GLvoid *pixels );
192
193
194 extern void GLAPIENTRY
195 _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
196 GLint x, GLint y, GLsizei width, GLint border );
197
198
199 extern void GLAPIENTRY
200 _mesa_CopyTexImage2D( GLenum target, GLint level,
201 GLenum internalformat, GLint x, GLint y,
202 GLsizei width, GLsizei height, GLint border );
203
204
205 extern void GLAPIENTRY
206 _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
207 GLint x, GLint y, GLsizei width );
208
209
210 extern void GLAPIENTRY
211 _mesa_CopyTexSubImage2D( GLenum target, GLint level,
212 GLint xoffset, GLint yoffset,
213 GLint x, GLint y, GLsizei width, GLsizei height );
214
215
216 extern void GLAPIENTRY
217 _mesa_CopyTexSubImage3D( GLenum target, GLint level,
218 GLint xoffset, GLint yoffset, GLint zoffset,
219 GLint x, GLint y, GLsizei width, GLsizei height );
220
221
222
223 extern void GLAPIENTRY
224 _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
225 GLenum internalformat, GLsizei width,
226 GLint border, GLsizei imageSize,
227 const GLvoid *data);
228
229 extern void GLAPIENTRY
230 _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
231 GLenum internalformat, GLsizei width,
232 GLsizei height, GLint border, GLsizei imageSize,
233 const GLvoid *data);
234
235 extern void GLAPIENTRY
236 _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
237 GLenum internalformat, GLsizei width,
238 GLsizei height, GLsizei depth, GLint border,
239 GLsizei imageSize, const GLvoid *data);
240
241 #ifdef VMS
242 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
243 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
244 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
245 #endif
246 extern void GLAPIENTRY
247 _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
248 GLsizei width, GLenum format,
249 GLsizei imageSize, const GLvoid *data);
250
251 extern void GLAPIENTRY
252 _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
253 GLint yoffset, GLsizei width, GLsizei height,
254 GLenum format, GLsizei imageSize,
255 const GLvoid *data);
256
257 extern void GLAPIENTRY
258 _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
259 GLint yoffset, GLint zoffset, GLsizei width,
260 GLsizei height, GLsizei depth, GLenum format,
261 GLsizei imageSize, const GLvoid *data);
262
263 /*@}*/
264
265 #endif