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( GLcontext
*ctx
, GLint internalFormat
);
53 _mesa_is_proxy_texture(GLenum target
);
56 extern struct gl_texture_image
*
57 _mesa_new_texture_image( GLcontext
*ctx
);
61 _mesa_delete_texture_image( GLcontext
*ctx
, struct gl_texture_image
*teximage
);
64 _mesa_free_texture_image_data( GLcontext
*ctx
,
65 struct gl_texture_image
*texImage
);
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
);
76 _mesa_clear_texture_image(GLcontext
*ctx
, struct gl_texture_image
*texImage
);
80 _mesa_set_tex_image(struct gl_texture_object
*tObj
,
81 GLenum target
, GLint level
,
82 struct gl_texture_image
*texImage
);
85 extern struct gl_texture_object
*
86 _mesa_select_tex_object(GLcontext
*ctx
, const struct gl_texture_unit
*texUnit
,
89 extern struct gl_texture_object
*
90 _mesa_get_current_tex_object(GLcontext
*ctx
, GLenum target
);
93 extern struct gl_texture_image
*
94 _mesa_select_tex_image(GLcontext
*ctx
, const struct gl_texture_object
*texObj
,
95 GLenum target
, GLint level
);
98 extern struct gl_texture_image
*
99 _mesa_get_tex_image(GLcontext
*ctx
, struct gl_texture_object
*texObj
,
100 GLenum target
, GLint level
);
103 extern struct gl_texture_image
*
104 _mesa_get_proxy_tex_image(GLcontext
*ctx
, GLenum target
, GLint level
);
108 _mesa_max_texture_levels(GLcontext
*ctx
, GLenum target
);
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
);
118 _mesa_tex_target_to_face(GLenum target
);
122 * Lock a texture for updating. See also _mesa_lock_context_textures().
125 _mesa_lock_texture(GLcontext
*ctx
, struct gl_texture_object
*texObj
)
127 _glthread_LOCK_MUTEX(ctx
->Shared
->TexMutex
);
128 ctx
->Shared
->TextureStateStamp
++;
133 _mesa_unlock_texture(GLcontext
*ctx
, struct gl_texture_object
*texObj
)
135 _glthread_UNLOCK_MUTEX(ctx
->Shared
->TexMutex
);
141 /** \name API entry point functions */
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
);
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
);
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
);
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
);
169 extern void GLAPIENTRY
170 _mesa_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
172 GLenum format
, GLenum type
,
173 const GLvoid
*pixels
);
176 extern void GLAPIENTRY
177 _mesa_TexSubImage2D( GLenum target
, GLint level
,
178 GLint xoffset
, GLint yoffset
,
179 GLsizei width
, GLsizei height
,
180 GLenum format
, GLenum type
,
181 const GLvoid
*pixels
);
184 extern void GLAPIENTRY
185 _mesa_TexSubImage3D( GLenum target
, GLint level
,
186 GLint xoffset
, GLint yoffset
, GLint zoffset
,
187 GLsizei width
, GLsizei height
, GLsizei depth
,
188 GLenum format
, GLenum type
,
189 const GLvoid
*pixels
);
192 extern void GLAPIENTRY
193 _mesa_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
194 GLint x
, GLint y
, GLsizei width
, GLint border
);
197 extern void GLAPIENTRY
198 _mesa_CopyTexImage2D( GLenum target
, GLint level
,
199 GLenum internalformat
, GLint x
, GLint y
,
200 GLsizei width
, GLsizei height
, GLint border
);
203 extern void GLAPIENTRY
204 _mesa_CopyTexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
205 GLint x
, GLint y
, GLsizei width
);
208 extern void GLAPIENTRY
209 _mesa_CopyTexSubImage2D( GLenum target
, GLint level
,
210 GLint xoffset
, GLint yoffset
,
211 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
214 extern void GLAPIENTRY
215 _mesa_CopyTexSubImage3D( GLenum target
, GLint level
,
216 GLint xoffset
, GLint yoffset
, GLint zoffset
,
217 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
221 extern void GLAPIENTRY
222 _mesa_CompressedTexImage1DARB(GLenum target
, GLint level
,
223 GLenum internalformat
, GLsizei width
,
224 GLint border
, GLsizei imageSize
,
227 extern void GLAPIENTRY
228 _mesa_CompressedTexImage2DARB(GLenum target
, GLint level
,
229 GLenum internalformat
, GLsizei width
,
230 GLsizei height
, GLint border
, GLsizei imageSize
,
233 extern void GLAPIENTRY
234 _mesa_CompressedTexImage3DARB(GLenum target
, GLint level
,
235 GLenum internalformat
, GLsizei width
,
236 GLsizei height
, GLsizei depth
, GLint border
,
237 GLsizei imageSize
, const GLvoid
*data
);
240 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
241 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
242 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
244 extern void GLAPIENTRY
245 _mesa_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
246 GLsizei width
, GLenum format
,
247 GLsizei imageSize
, const GLvoid
*data
);
249 extern void GLAPIENTRY
250 _mesa_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
251 GLint yoffset
, GLsizei width
, GLsizei height
,
252 GLenum format
, GLsizei imageSize
,
255 extern void GLAPIENTRY
256 _mesa_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
257 GLint yoffset
, GLint zoffset
, GLsizei width
,
258 GLsizei height
, GLsizei depth
, GLenum format
,
259 GLsizei imageSize
, const GLvoid
*data
);