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
,
90 extern struct gl_texture_image
*
91 _mesa_select_tex_image(GLcontext
*ctx
, const struct gl_texture_object
*texObj
,
92 GLenum target
, GLint level
);
95 extern struct gl_texture_image
*
96 _mesa_get_tex_image(GLcontext
*ctx
, struct gl_texture_object
*texObj
,
97 GLenum target
, GLint level
);
100 extern struct gl_texture_image
*
101 _mesa_get_proxy_tex_image(GLcontext
*ctx
, GLenum target
, GLint level
);
105 _mesa_max_texture_levels(GLcontext
*ctx
, GLenum target
);
109 _mesa_test_proxy_teximage(GLcontext
*ctx
, GLenum target
, GLint level
,
110 GLint internalFormat
, GLenum format
, GLenum type
,
111 GLint width
, GLint height
, GLint depth
, GLint border
);
115 _mesa_tex_target_to_face(GLenum target
);
119 * Lock a texture for updating. See also _mesa_lock_context_textures().
122 _mesa_lock_texture(GLcontext
*ctx
, struct gl_texture_object
*texObj
)
124 _glthread_LOCK_MUTEX(ctx
->Shared
->TexMutex
);
125 ctx
->Shared
->TextureStateStamp
++;
130 _mesa_unlock_texture(GLcontext
*ctx
, struct gl_texture_object
*texObj
)
132 _glthread_UNLOCK_MUTEX(ctx
->Shared
->TexMutex
);
138 /** \name API entry point functions */
141 extern void GLAPIENTRY
142 _mesa_TexImage1D( GLenum target
, GLint level
, GLint internalformat
,
143 GLsizei width
, GLint border
,
144 GLenum format
, GLenum type
, const GLvoid
*pixels
);
147 extern void GLAPIENTRY
148 _mesa_TexImage2D( GLenum target
, GLint level
, GLint internalformat
,
149 GLsizei width
, GLsizei height
, GLint border
,
150 GLenum format
, GLenum type
, const GLvoid
*pixels
);
153 extern void GLAPIENTRY
154 _mesa_TexImage3D( GLenum target
, GLint level
, GLint internalformat
,
155 GLsizei width
, GLsizei height
, GLsizei depth
, GLint border
,
156 GLenum format
, GLenum type
, const GLvoid
*pixels
);
159 extern void GLAPIENTRY
160 _mesa_TexImage3DEXT( GLenum target
, GLint level
, GLenum internalformat
,
161 GLsizei width
, GLsizei height
, GLsizei depth
,
162 GLint border
, GLenum format
, GLenum type
,
163 const GLvoid
*pixels
);
166 extern void GLAPIENTRY
167 _mesa_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
169 GLenum format
, GLenum type
,
170 const GLvoid
*pixels
);
173 extern void GLAPIENTRY
174 _mesa_TexSubImage2D( GLenum target
, GLint level
,
175 GLint xoffset
, GLint yoffset
,
176 GLsizei width
, GLsizei height
,
177 GLenum format
, GLenum type
,
178 const GLvoid
*pixels
);
181 extern void GLAPIENTRY
182 _mesa_TexSubImage3D( GLenum target
, GLint level
,
183 GLint xoffset
, GLint yoffset
, GLint zoffset
,
184 GLsizei width
, GLsizei height
, GLsizei depth
,
185 GLenum format
, GLenum type
,
186 const GLvoid
*pixels
);
189 extern void GLAPIENTRY
190 _mesa_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
191 GLint x
, GLint y
, GLsizei width
, GLint border
);
194 extern void GLAPIENTRY
195 _mesa_CopyTexImage2D( GLenum target
, GLint level
,
196 GLenum internalformat
, GLint x
, GLint y
,
197 GLsizei width
, GLsizei height
, GLint border
);
200 extern void GLAPIENTRY
201 _mesa_CopyTexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
202 GLint x
, GLint y
, GLsizei width
);
205 extern void GLAPIENTRY
206 _mesa_CopyTexSubImage2D( GLenum target
, GLint level
,
207 GLint xoffset
, GLint yoffset
,
208 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
211 extern void GLAPIENTRY
212 _mesa_CopyTexSubImage3D( GLenum target
, GLint level
,
213 GLint xoffset
, GLint yoffset
, GLint zoffset
,
214 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
218 extern void GLAPIENTRY
219 _mesa_CompressedTexImage1DARB(GLenum target
, GLint level
,
220 GLenum internalformat
, GLsizei width
,
221 GLint border
, GLsizei imageSize
,
224 extern void GLAPIENTRY
225 _mesa_CompressedTexImage2DARB(GLenum target
, GLint level
,
226 GLenum internalformat
, GLsizei width
,
227 GLsizei height
, GLint border
, GLsizei imageSize
,
230 extern void GLAPIENTRY
231 _mesa_CompressedTexImage3DARB(GLenum target
, GLint level
,
232 GLenum internalformat
, GLsizei width
,
233 GLsizei height
, GLsizei depth
, GLint border
,
234 GLsizei imageSize
, const GLvoid
*data
);
237 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
238 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
239 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
241 extern void GLAPIENTRY
242 _mesa_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
243 GLsizei width
, GLenum format
,
244 GLsizei imageSize
, const GLvoid
*data
);
246 extern void GLAPIENTRY
247 _mesa_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
248 GLint yoffset
, GLsizei width
, GLsizei height
,
249 GLenum format
, GLsizei imageSize
,
252 extern void GLAPIENTRY
253 _mesa_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
254 GLint yoffset
, GLint zoffset
, GLsizei width
,
255 GLsizei height
, GLsizei depth
, GLenum format
,
256 GLsizei imageSize
, const GLvoid
*data
);