3 * Texture images manipulation functions.
7 * Mesa 3-D graphics library
10 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
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:
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
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.
40 _mesa_alloc_texmemory(GLsizei bytes
);
43 _mesa_free_texmemory(void *m
);
46 /** \name Internal functions */
50 _mesa_base_tex_format( struct gl_context
*ctx
, GLint internalFormat
);
54 _mesa_is_proxy_texture(GLenum target
);
57 extern struct gl_texture_image
*
58 _mesa_new_texture_image( struct gl_context
*ctx
);
62 _mesa_delete_texture_image( struct gl_context
*ctx
, struct gl_texture_image
*teximage
);
65 _mesa_free_texture_image_data( struct gl_context
*ctx
,
66 struct gl_texture_image
*texImage
);
70 _mesa_init_teximage_fields(struct gl_context
*ctx
, GLenum target
,
71 struct gl_texture_image
*img
,
72 GLsizei width
, GLsizei height
, GLsizei depth
,
73 GLint border
, GLenum internalFormat
,
78 _mesa_choose_texture_format(struct gl_context
*ctx
,
79 struct gl_texture_object
*texObj
,
80 GLenum target
, GLint level
,
81 GLenum internalFormat
, GLenum format
, GLenum type
);
85 _mesa_clear_texture_image(struct gl_context
*ctx
, struct gl_texture_image
*texImage
);
89 _mesa_set_tex_image(struct gl_texture_object
*tObj
,
90 GLenum target
, GLint level
,
91 struct gl_texture_image
*texImage
);
94 extern struct gl_texture_object
*
95 _mesa_select_tex_object(struct gl_context
*ctx
, const struct gl_texture_unit
*texUnit
,
98 extern struct gl_texture_object
*
99 _mesa_get_current_tex_object(struct gl_context
*ctx
, GLenum target
);
102 extern struct gl_texture_image
*
103 _mesa_select_tex_image(struct gl_context
*ctx
, const struct gl_texture_object
*texObj
,
104 GLenum target
, GLint level
);
107 extern struct gl_texture_image
*
108 _mesa_get_tex_image(struct gl_context
*ctx
, struct gl_texture_object
*texObj
,
109 GLenum target
, GLint level
);
112 extern struct gl_texture_image
*
113 _mesa_get_proxy_tex_image(struct gl_context
*ctx
, GLenum target
, GLint level
);
117 _mesa_max_texture_levels(struct gl_context
*ctx
, GLenum target
);
121 _mesa_test_proxy_teximage(struct gl_context
*ctx
, GLenum target
, GLint level
,
122 GLint internalFormat
, GLenum format
, GLenum type
,
123 GLint width
, GLint height
, GLint depth
, GLint border
);
127 _mesa_tex_target_to_face(GLenum target
);
131 * Lock a texture for updating. See also _mesa_lock_context_textures().
134 _mesa_lock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
136 _glthread_LOCK_MUTEX(ctx
->Shared
->TexMutex
);
137 ctx
->Shared
->TextureStateStamp
++;
142 _mesa_unlock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
144 _glthread_UNLOCK_MUTEX(ctx
->Shared
->TexMutex
);
150 /** \name API entry point functions */
153 extern void GLAPIENTRY
154 _mesa_TexImage1D( GLenum target
, GLint level
, GLint internalformat
,
155 GLsizei width
, GLint border
,
156 GLenum format
, GLenum type
, const GLvoid
*pixels
);
159 extern void GLAPIENTRY
160 _mesa_TexImage2D( GLenum target
, GLint level
, GLint internalformat
,
161 GLsizei width
, GLsizei height
, GLint border
,
162 GLenum format
, GLenum type
, const GLvoid
*pixels
);
165 extern void GLAPIENTRY
166 _mesa_TexImage3D( GLenum target
, GLint level
, GLint internalformat
,
167 GLsizei width
, GLsizei height
, GLsizei depth
, GLint border
,
168 GLenum format
, GLenum type
, const GLvoid
*pixels
);
171 extern void GLAPIENTRY
172 _mesa_TexImage3DEXT( GLenum target
, GLint level
, GLenum internalformat
,
173 GLsizei width
, GLsizei height
, GLsizei depth
,
174 GLint border
, GLenum format
, GLenum type
,
175 const GLvoid
*pixels
);
177 extern void GLAPIENTRY
178 _mesa_EGLImageTargetTexture2DOES( GLenum target
, GLeglImageOES image
);
180 extern void GLAPIENTRY
181 _mesa_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
183 GLenum format
, GLenum type
,
184 const GLvoid
*pixels
);
187 extern void GLAPIENTRY
188 _mesa_TexSubImage2D( GLenum target
, GLint level
,
189 GLint xoffset
, GLint yoffset
,
190 GLsizei width
, GLsizei height
,
191 GLenum format
, GLenum type
,
192 const GLvoid
*pixels
);
195 extern void GLAPIENTRY
196 _mesa_TexSubImage3D( GLenum target
, GLint level
,
197 GLint xoffset
, GLint yoffset
, GLint zoffset
,
198 GLsizei width
, GLsizei height
, GLsizei depth
,
199 GLenum format
, GLenum type
,
200 const GLvoid
*pixels
);
203 extern void GLAPIENTRY
204 _mesa_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
205 GLint x
, GLint y
, GLsizei width
, GLint border
);
208 extern void GLAPIENTRY
209 _mesa_CopyTexImage2D( GLenum target
, GLint level
,
210 GLenum internalformat
, GLint x
, GLint y
,
211 GLsizei width
, GLsizei height
, GLint border
);
214 extern void GLAPIENTRY
215 _mesa_CopyTexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
216 GLint x
, GLint y
, GLsizei width
);
219 extern void GLAPIENTRY
220 _mesa_CopyTexSubImage2D( GLenum target
, GLint level
,
221 GLint xoffset
, GLint yoffset
,
222 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
225 extern void GLAPIENTRY
226 _mesa_CopyTexSubImage3D( GLenum target
, GLint level
,
227 GLint xoffset
, GLint yoffset
, GLint zoffset
,
228 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
232 extern void GLAPIENTRY
233 _mesa_CompressedTexImage1DARB(GLenum target
, GLint level
,
234 GLenum internalformat
, GLsizei width
,
235 GLint border
, GLsizei imageSize
,
238 extern void GLAPIENTRY
239 _mesa_CompressedTexImage2DARB(GLenum target
, GLint level
,
240 GLenum internalformat
, GLsizei width
,
241 GLsizei height
, GLint border
, GLsizei imageSize
,
244 extern void GLAPIENTRY
245 _mesa_CompressedTexImage3DARB(GLenum target
, GLint level
,
246 GLenum internalformat
, GLsizei width
,
247 GLsizei height
, GLsizei depth
, GLint border
,
248 GLsizei imageSize
, const GLvoid
*data
);
251 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
252 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
253 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
255 extern void GLAPIENTRY
256 _mesa_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
257 GLsizei width
, GLenum format
,
258 GLsizei imageSize
, const GLvoid
*data
);
260 extern void GLAPIENTRY
261 _mesa_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
262 GLint yoffset
, GLsizei width
, GLsizei height
,
263 GLenum format
, GLsizei imageSize
,
266 extern void GLAPIENTRY
267 _mesa_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
268 GLint yoffset
, GLint zoffset
, GLsizei width
,
269 GLsizei height
, GLsizei depth
, GLenum format
,
270 GLsizei imageSize
, const GLvoid
*data
);