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 /** \name Internal functions */
43 _mesa_base_tex_format( struct gl_context
*ctx
, GLint internalFormat
);
47 _mesa_is_proxy_texture(GLenum target
);
50 extern struct gl_texture_image
*
51 _mesa_new_texture_image( struct gl_context
*ctx
);
55 _mesa_delete_texture_image( struct gl_context
*ctx
,
56 struct gl_texture_image
*teximage
);
60 _mesa_init_teximage_fields(struct gl_context
*ctx
, GLenum target
,
61 struct gl_texture_image
*img
,
62 GLsizei width
, GLsizei height
, GLsizei depth
,
63 GLint border
, GLenum internalFormat
,
68 _mesa_choose_texture_format(struct gl_context
*ctx
,
69 struct gl_texture_object
*texObj
,
70 GLenum target
, GLint level
,
71 GLenum internalFormat
, GLenum format
, GLenum type
);
75 _mesa_clear_texture_image(struct gl_context
*ctx
,
76 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(struct gl_context
*ctx
,
87 const struct gl_texture_unit
*texUnit
,
90 extern struct gl_texture_object
*
91 _mesa_get_current_tex_object(struct gl_context
*ctx
, GLenum target
);
94 extern struct gl_texture_image
*
95 _mesa_select_tex_image(struct gl_context
*ctx
,
96 const struct gl_texture_object
*texObj
,
97 GLenum target
, GLint level
);
100 extern struct gl_texture_image
*
101 _mesa_get_tex_image(struct gl_context
*ctx
, struct gl_texture_object
*texObj
,
102 GLenum target
, GLint level
);
105 extern struct gl_texture_image
*
106 _mesa_get_proxy_tex_image(struct gl_context
*ctx
, GLenum target
, GLint level
);
110 _mesa_max_texture_levels(struct gl_context
*ctx
, GLenum target
);
114 _mesa_test_proxy_teximage(struct gl_context
*ctx
, GLenum target
, GLint level
,
115 GLint internalFormat
, GLenum format
, GLenum type
,
116 GLint width
, GLint height
, GLint depth
, GLint border
);
120 _mesa_tex_target_to_face(GLenum target
);
123 _mesa_get_texture_dimensions(GLenum target
);
126 * Lock a texture for updating. See also _mesa_lock_context_textures().
129 _mesa_lock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
131 _glthread_LOCK_MUTEX(ctx
->Shared
->TexMutex
);
132 ctx
->Shared
->TextureStateStamp
++;
137 _mesa_unlock_texture(struct gl_context
*ctx
, struct gl_texture_object
*texObj
)
140 _glthread_UNLOCK_MUTEX(ctx
->Shared
->TexMutex
);
146 /** \name API entry point functions */
149 extern void GLAPIENTRY
150 _mesa_TexImage1D( GLenum target
, GLint level
, GLint internalformat
,
151 GLsizei width
, GLint border
,
152 GLenum format
, GLenum type
, const GLvoid
*pixels
);
155 extern void GLAPIENTRY
156 _mesa_TexImage2D( GLenum target
, GLint level
, GLint internalformat
,
157 GLsizei width
, GLsizei height
, GLint border
,
158 GLenum format
, GLenum type
, const GLvoid
*pixels
);
161 extern void GLAPIENTRY
162 _mesa_TexImage3D( GLenum target
, GLint level
, GLint internalformat
,
163 GLsizei width
, GLsizei height
, GLsizei depth
, GLint border
,
164 GLenum format
, GLenum type
, const GLvoid
*pixels
);
167 extern void GLAPIENTRY
168 _mesa_TexImage3DEXT( GLenum target
, GLint level
, GLenum internalformat
,
169 GLsizei width
, GLsizei height
, GLsizei depth
,
170 GLint border
, GLenum format
, GLenum type
,
171 const GLvoid
*pixels
);
173 extern void GLAPIENTRY
174 _mesa_EGLImageTargetTexture2DOES( GLenum target
, GLeglImageOES image
);
176 extern void GLAPIENTRY
177 _mesa_TexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
179 GLenum format
, GLenum type
,
180 const GLvoid
*pixels
);
183 extern void GLAPIENTRY
184 _mesa_TexSubImage2D( GLenum target
, GLint level
,
185 GLint xoffset
, GLint yoffset
,
186 GLsizei width
, GLsizei height
,
187 GLenum format
, GLenum type
,
188 const GLvoid
*pixels
);
191 extern void GLAPIENTRY
192 _mesa_TexSubImage3D( GLenum target
, GLint level
,
193 GLint xoffset
, GLint yoffset
, GLint zoffset
,
194 GLsizei width
, GLsizei height
, GLsizei depth
,
195 GLenum format
, GLenum type
,
196 const GLvoid
*pixels
);
199 extern void GLAPIENTRY
200 _mesa_CopyTexImage1D( GLenum target
, GLint level
, GLenum internalformat
,
201 GLint x
, GLint y
, GLsizei width
, GLint border
);
204 extern void GLAPIENTRY
205 _mesa_CopyTexImage2D( GLenum target
, GLint level
,
206 GLenum internalformat
, GLint x
, GLint y
,
207 GLsizei width
, GLsizei height
, GLint border
);
210 extern void GLAPIENTRY
211 _mesa_CopyTexSubImage1D( GLenum target
, GLint level
, GLint xoffset
,
212 GLint x
, GLint y
, GLsizei width
);
215 extern void GLAPIENTRY
216 _mesa_CopyTexSubImage2D( GLenum target
, GLint level
,
217 GLint xoffset
, GLint yoffset
,
218 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
221 extern void GLAPIENTRY
222 _mesa_CopyTexSubImage3D( GLenum target
, GLint level
,
223 GLint xoffset
, GLint yoffset
, GLint zoffset
,
224 GLint x
, GLint y
, GLsizei width
, GLsizei height
);
228 extern void GLAPIENTRY
229 _mesa_CompressedTexImage1DARB(GLenum target
, GLint level
,
230 GLenum internalformat
, GLsizei width
,
231 GLint border
, GLsizei imageSize
,
234 extern void GLAPIENTRY
235 _mesa_CompressedTexImage2DARB(GLenum target
, GLint level
,
236 GLenum internalformat
, GLsizei width
,
237 GLsizei height
, GLint border
, GLsizei imageSize
,
240 extern void GLAPIENTRY
241 _mesa_CompressedTexImage3DARB(GLenum target
, GLint level
,
242 GLenum internalformat
, GLsizei width
,
243 GLsizei height
, GLsizei depth
, GLint border
,
244 GLsizei imageSize
, const GLvoid
*data
);
247 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
248 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
249 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
251 extern void GLAPIENTRY
252 _mesa_CompressedTexSubImage1DARB(GLenum target
, GLint level
, GLint xoffset
,
253 GLsizei width
, GLenum format
,
254 GLsizei imageSize
, const GLvoid
*data
);
256 extern void GLAPIENTRY
257 _mesa_CompressedTexSubImage2DARB(GLenum target
, GLint level
, GLint xoffset
,
258 GLint yoffset
, GLsizei width
, GLsizei height
,
259 GLenum format
, GLsizei imageSize
,
262 extern void GLAPIENTRY
263 _mesa_CompressedTexSubImage3DARB(GLenum target
, GLint level
, GLint xoffset
,
264 GLint yoffset
, GLint zoffset
, GLsizei width
,
265 GLsizei height
, GLsizei depth
, GLenum format
,
266 GLsizei imageSize
, const GLvoid
*data
);
269 extern void GLAPIENTRY
270 _mesa_TexBuffer(GLenum target
, GLenum internalFormat
, GLuint buffer
);