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
,
63 struct gl_texture_image
*teximage
);
66 _mesa_free_texture_image_data( struct gl_context
*ctx
,
67 struct gl_texture_image
*texImage
);
71 _mesa_init_teximage_fields(struct gl_context
*ctx
, GLenum target
,
72 struct gl_texture_image
*img
,
73 GLsizei width
, GLsizei height
, GLsizei depth
,
74 GLint border
, GLenum internalFormat
,
79 _mesa_choose_texture_format(struct gl_context
*ctx
,
80 struct gl_texture_object
*texObj
,
81 GLenum target
, GLint level
,
82 GLenum internalFormat
, GLenum format
, GLenum type
);
86 _mesa_clear_texture_image(struct gl_context
*ctx
,
87 struct gl_texture_image
*texImage
);
91 _mesa_set_tex_image(struct gl_texture_object
*tObj
,
92 GLenum target
, GLint level
,
93 struct gl_texture_image
*texImage
);
96 extern struct gl_texture_object
*
97 _mesa_select_tex_object(struct gl_context
*ctx
,
98 const struct gl_texture_unit
*texUnit
,
101 extern struct gl_texture_object
*
102 _mesa_get_current_tex_object(struct gl_context
*ctx
, GLenum target
);
105 extern struct gl_texture_image
*
106 _mesa_select_tex_image(struct gl_context
*ctx
,
107 const struct gl_texture_object
*texObj
,
108 GLenum target
, GLint level
);
111 extern struct gl_texture_image
*
112 _mesa_get_tex_image(struct gl_context
*ctx
, struct gl_texture_object
*texObj
,
113 GLenum target
, GLint level
);
116 extern struct gl_texture_image
*
117 _mesa_get_proxy_tex_image(struct gl_context
*ctx
, GLenum target
, GLint level
);
121 _mesa_max_texture_levels(struct gl_context
*ctx
, GLenum target
);
125 _mesa_test_proxy_teximage(struct gl_context
*ctx
, GLenum target
, GLint level
,
126 GLint internalFormat
, GLenum format
, GLenum type
,
127 GLint width
, GLint height
, GLint depth
, GLint border
);
131 _mesa_tex_target_to_face(GLenum target
);
134 _mesa_get_texture_dimensions(GLenum target
);
137 * Lock a texture for updating. See also _mesa_lock_context_textures().
140 _mesa_lock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
142 _glthread_LOCK_MUTEX(ctx
->Shared
->TexMutex
);
143 ctx
->Shared
->TextureStateStamp
++;
148 _mesa_unlock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
151 _glthread_UNLOCK_MUTEX(ctx
->Shared
->TexMutex
);
157 /** \name API entry point functions */
160 extern void GLAPIENTRY
161 _mesa_TexImage1D( GLenum target
, GLint level
, GLint internalformat
,
162 GLsizei width
, GLint border
,
163 GLenum format
, GLenum type
, const GLvoid
*pixels
);
166 extern void GLAPIENTRY
167 _mesa_TexImage2D( GLenum target
, GLint level
, GLint internalformat
,
168 GLsizei width
, GLsizei height
, GLint border
,
169 GLenum format
, GLenum type
, const GLvoid
*pixels
);
172 extern void GLAPIENTRY
173 _mesa_TexImage3D( GLenum target
, GLint level
, GLint internalformat
,
174 GLsizei width
, GLsizei height
, GLsizei depth
, GLint border
,
175 GLenum format
, GLenum type
, const GLvoid
*pixels
);
178 extern void GLAPIENTRY
179 _mesa_TexImage3DEXT( GLenum target
, GLint level
, GLenum internalformat
,
180 GLsizei width
, GLsizei height
, GLsizei depth
,
181 GLint border
, GLenum format
, GLenum type
,
182 const GLvoid
*pixels
);
184 extern void GLAPIENTRY
185 _mesa_EGLImageTargetTexture2DOES( GLenum target
, GLeglImageOES image
);
187 extern void GLAPIENTRY
188 _mesa_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
190 GLenum format
, GLenum type
,
191 const GLvoid
*pixels
);
194 extern void GLAPIENTRY
195 _mesa_TexSubImage2D( GLenum target
, GLint level
,
196 GLint xoffset
, GLint yoffset
,
197 GLsizei width
, GLsizei height
,
198 GLenum format
, GLenum type
,
199 const GLvoid
*pixels
);
202 extern void GLAPIENTRY
203 _mesa_TexSubImage3D( GLenum target
, GLint level
,
204 GLint xoffset
, GLint yoffset
, GLint zoffset
,
205 GLsizei width
, GLsizei height
, GLsizei depth
,
206 GLenum format
, GLenum type
,
207 const GLvoid
*pixels
);
210 extern void GLAPIENTRY
211 _mesa_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
212 GLint x
, GLint y
, GLsizei width
, GLint border
);
215 extern void GLAPIENTRY
216 _mesa_CopyTexImage2D( GLenum target
, GLint level
,
217 GLenum internalformat
, GLint x
, GLint y
,
218 GLsizei width
, GLsizei height
, GLint border
);
221 extern void GLAPIENTRY
222 _mesa_CopyTexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
223 GLint x
, GLint y
, GLsizei width
);
226 extern void GLAPIENTRY
227 _mesa_CopyTexSubImage2D( GLenum target
, GLint level
,
228 GLint xoffset
, GLint yoffset
,
229 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
232 extern void GLAPIENTRY
233 _mesa_CopyTexSubImage3D( GLenum target
, GLint level
,
234 GLint xoffset
, GLint yoffset
, GLint zoffset
,
235 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
239 extern void GLAPIENTRY
240 _mesa_CompressedTexImage1DARB(GLenum target
, GLint level
,
241 GLenum internalformat
, GLsizei width
,
242 GLint border
, GLsizei imageSize
,
245 extern void GLAPIENTRY
246 _mesa_CompressedTexImage2DARB(GLenum target
, GLint level
,
247 GLenum internalformat
, GLsizei width
,
248 GLsizei height
, GLint border
, GLsizei imageSize
,
251 extern void GLAPIENTRY
252 _mesa_CompressedTexImage3DARB(GLenum target
, GLint level
,
253 GLenum internalformat
, GLsizei width
,
254 GLsizei height
, GLsizei depth
, GLint border
,
255 GLsizei imageSize
, const GLvoid
*data
);
258 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
259 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
260 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
262 extern void GLAPIENTRY
263 _mesa_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
264 GLsizei width
, GLenum format
,
265 GLsizei imageSize
, const GLvoid
*data
);
267 extern void GLAPIENTRY
268 _mesa_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
269 GLint yoffset
, GLsizei width
, GLsizei height
,
270 GLenum format
, GLsizei imageSize
,
273 extern void GLAPIENTRY
274 _mesa_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
275 GLint yoffset
, GLint zoffset
, GLsizei width
,
276 GLsizei height
, GLsizei depth
, GLenum format
,
277 GLsizei imageSize
, const GLvoid
*data
);
280 extern void GLAPIENTRY
281 _mesa_TexBuffer(GLenum target
, GLenum internalFormat
, GLuint buffer
);