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.
39 _mesa_alloc_texmemory(GLsizei bytes
);
42 _mesa_free_texmemory(void *m
);
45 /** \name Internal functions */
49 _mesa_base_tex_format( struct gl_context
*ctx
, GLint internalFormat
);
53 _mesa_is_proxy_texture(GLenum target
);
56 extern struct gl_texture_image
*
57 _mesa_new_texture_image( struct gl_context
*ctx
);
61 _mesa_delete_texture_image( struct gl_context
*ctx
, struct gl_texture_image
*teximage
);
64 _mesa_free_texture_image_data( struct gl_context
*ctx
,
65 struct gl_texture_image
*texImage
);
69 _mesa_init_teximage_fields(struct gl_context
*ctx
, GLenum target
,
70 struct gl_texture_image
*img
,
71 GLsizei width
, GLsizei height
, GLsizei depth
,
72 GLint border
, GLenum internalFormat
);
76 _mesa_choose_texture_format(struct gl_context
*ctx
,
77 struct gl_texture_object
*texObj
,
78 struct gl_texture_image
*texImage
,
79 GLenum target
, GLint level
,
80 GLenum internalFormat
, GLenum format
, GLenum type
);
84 _mesa_clear_texture_image(struct gl_context
*ctx
, struct gl_texture_image
*texImage
);
88 _mesa_set_tex_image(struct gl_texture_object
*tObj
,
89 GLenum target
, GLint level
,
90 struct gl_texture_image
*texImage
);
93 extern struct gl_texture_object
*
94 _mesa_select_tex_object(struct gl_context
*ctx
, const struct gl_texture_unit
*texUnit
,
97 extern struct gl_texture_object
*
98 _mesa_get_current_tex_object(struct gl_context
*ctx
, GLenum target
);
101 extern struct gl_texture_image
*
102 _mesa_select_tex_image(struct gl_context
*ctx
, const struct gl_texture_object
*texObj
,
103 GLenum target
, GLint level
);
106 extern struct gl_texture_image
*
107 _mesa_get_tex_image(struct gl_context
*ctx
, struct gl_texture_object
*texObj
,
108 GLenum target
, GLint level
);
111 extern struct gl_texture_image
*
112 _mesa_get_proxy_tex_image(struct gl_context
*ctx
, GLenum target
, GLint level
);
116 _mesa_max_texture_levels(struct gl_context
*ctx
, GLenum target
);
120 _mesa_test_proxy_teximage(struct gl_context
*ctx
, GLenum target
, GLint level
,
121 GLint internalFormat
, GLenum format
, GLenum type
,
122 GLint width
, GLint height
, GLint depth
, GLint border
);
126 _mesa_tex_target_to_face(GLenum target
);
130 * Lock a texture for updating. See also _mesa_lock_context_textures().
133 _mesa_lock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
135 _glthread_LOCK_MUTEX(ctx
->Shared
->TexMutex
);
136 ctx
->Shared
->TextureStateStamp
++;
141 _mesa_unlock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
143 _glthread_UNLOCK_MUTEX(ctx
->Shared
->TexMutex
);
149 /** \name API entry point functions */
152 extern void GLAPIENTRY
153 _mesa_TexImage1D( GLenum target
, GLint level
, GLint internalformat
,
154 GLsizei width
, GLint border
,
155 GLenum format
, GLenum type
, const GLvoid
*pixels
);
158 extern void GLAPIENTRY
159 _mesa_TexImage2D( GLenum target
, GLint level
, GLint internalformat
,
160 GLsizei width
, GLsizei height
, GLint border
,
161 GLenum format
, GLenum type
, const GLvoid
*pixels
);
164 extern void GLAPIENTRY
165 _mesa_TexImage3D( GLenum target
, GLint level
, GLint internalformat
,
166 GLsizei width
, GLsizei height
, GLsizei depth
, GLint border
,
167 GLenum format
, GLenum type
, const GLvoid
*pixels
);
170 extern void GLAPIENTRY
171 _mesa_TexImage3DEXT( GLenum target
, GLint level
, GLenum internalformat
,
172 GLsizei width
, GLsizei height
, GLsizei depth
,
173 GLint border
, GLenum format
, GLenum type
,
174 const GLvoid
*pixels
);
176 extern void GLAPIENTRY
177 _mesa_EGLImageTargetTexture2DOES( GLenum target
, GLeglImageOES image
);
179 extern void GLAPIENTRY
180 _mesa_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
182 GLenum format
, GLenum type
,
183 const GLvoid
*pixels
);
186 extern void GLAPIENTRY
187 _mesa_TexSubImage2D( GLenum target
, GLint level
,
188 GLint xoffset
, GLint yoffset
,
189 GLsizei width
, GLsizei height
,
190 GLenum format
, GLenum type
,
191 const GLvoid
*pixels
);
194 extern void GLAPIENTRY
195 _mesa_TexSubImage3D( GLenum target
, GLint level
,
196 GLint xoffset
, GLint yoffset
, GLint zoffset
,
197 GLsizei width
, GLsizei height
, GLsizei depth
,
198 GLenum format
, GLenum type
,
199 const GLvoid
*pixels
);
202 extern void GLAPIENTRY
203 _mesa_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
204 GLint x
, GLint y
, GLsizei width
, GLint border
);
207 extern void GLAPIENTRY
208 _mesa_CopyTexImage2D( GLenum target
, GLint level
,
209 GLenum internalformat
, GLint x
, GLint y
,
210 GLsizei width
, GLsizei height
, GLint border
);
213 extern void GLAPIENTRY
214 _mesa_CopyTexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
215 GLint x
, GLint y
, GLsizei width
);
218 extern void GLAPIENTRY
219 _mesa_CopyTexSubImage2D( GLenum target
, GLint level
,
220 GLint xoffset
, GLint yoffset
,
221 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
224 extern void GLAPIENTRY
225 _mesa_CopyTexSubImage3D( GLenum target
, GLint level
,
226 GLint xoffset
, GLint yoffset
, GLint zoffset
,
227 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
231 extern void GLAPIENTRY
232 _mesa_CompressedTexImage1DARB(GLenum target
, GLint level
,
233 GLenum internalformat
, GLsizei width
,
234 GLint border
, GLsizei imageSize
,
237 extern void GLAPIENTRY
238 _mesa_CompressedTexImage2DARB(GLenum target
, GLint level
,
239 GLenum internalformat
, GLsizei width
,
240 GLsizei height
, GLint border
, GLsizei imageSize
,
243 extern void GLAPIENTRY
244 _mesa_CompressedTexImage3DARB(GLenum target
, GLint level
,
245 GLenum internalformat
, GLsizei width
,
246 GLsizei height
, GLsizei depth
, GLint border
,
247 GLsizei imageSize
, const GLvoid
*data
);
250 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
251 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
252 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
254 extern void GLAPIENTRY
255 _mesa_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
256 GLsizei width
, GLenum format
,
257 GLsizei imageSize
, const GLvoid
*data
);
259 extern void GLAPIENTRY
260 _mesa_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
261 GLint yoffset
, GLsizei width
, GLsizei height
,
262 GLenum format
, GLsizei imageSize
,
265 extern void GLAPIENTRY
266 _mesa_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
267 GLint yoffset
, GLint zoffset
, GLsizei width
,
268 GLsizei height
, GLsizei depth
, GLenum format
,
269 GLsizei imageSize
, const GLvoid
*data
);