mesa: remove _mesa_alloc_texmemory(), _mesa_free_texmemory()
[mesa.git] / src / mesa / main / teximage.h
1 /**
2 * \file teximage.h
3 * Texture images manipulation functions.
4 */
5
6 /*
7 * Mesa 3-D graphics library
8 * Version: 6.5
9 *
10 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
11 *
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:
18 *
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
21 *
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.
28 */
29
30
31 #ifndef TEXIMAGE_H
32 #define TEXIMAGE_H
33
34
35 #include "mtypes.h"
36 #include "formats.h"
37
38
39 /** \name Internal functions */
40 /*@{*/
41
42 extern GLint
43 _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
44
45
46 extern GLboolean
47 _mesa_is_proxy_texture(GLenum target);
48
49
50 extern struct gl_texture_image *
51 _mesa_new_texture_image( struct gl_context *ctx );
52
53
54 extern void
55 _mesa_delete_texture_image( struct gl_context *ctx,
56 struct gl_texture_image *teximage );
57
58
59 extern void
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,
64 gl_format format);
65
66
67 extern gl_format
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);
72
73
74 extern void
75 _mesa_clear_texture_image(struct gl_context *ctx,
76 struct gl_texture_image *texImage);
77
78
79 extern void
80 _mesa_set_tex_image(struct gl_texture_object *tObj,
81 GLenum target, GLint level,
82 struct gl_texture_image *texImage);
83
84
85 extern struct gl_texture_object *
86 _mesa_select_tex_object(struct gl_context *ctx,
87 const struct gl_texture_unit *texUnit,
88 GLenum target);
89
90 extern struct gl_texture_object *
91 _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target);
92
93
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);
98
99
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);
103
104
105 extern struct gl_texture_image *
106 _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
107
108
109 extern GLint
110 _mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
111
112
113 extern GLboolean
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);
117
118
119 extern GLuint
120 _mesa_tex_target_to_face(GLenum target);
121
122 extern GLint
123 _mesa_get_texture_dimensions(GLenum target);
124
125 /**
126 * Lock a texture for updating. See also _mesa_lock_context_textures().
127 */
128 static inline void
129 _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
130 {
131 _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
132 ctx->Shared->TextureStateStamp++;
133 (void) texObj;
134 }
135
136 static inline void
137 _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
138 {
139 (void) texObj;
140 _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
141 }
142
143 /*@}*/
144
145
146 /** \name API entry point functions */
147 /*@{*/
148
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 );
153
154
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 );
159
160
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 );
165
166
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 );
172
173 extern void GLAPIENTRY
174 _mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
175
176 extern void GLAPIENTRY
177 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
178 GLsizei width,
179 GLenum format, GLenum type,
180 const GLvoid *pixels );
181
182
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 );
189
190
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 );
197
198
199 extern void GLAPIENTRY
200 _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
201 GLint x, GLint y, GLsizei width, GLint border );
202
203
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 );
208
209
210 extern void GLAPIENTRY
211 _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
212 GLint x, GLint y, GLsizei width );
213
214
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 );
219
220
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 );
225
226
227
228 extern void GLAPIENTRY
229 _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
230 GLenum internalformat, GLsizei width,
231 GLint border, GLsizei imageSize,
232 const GLvoid *data);
233
234 extern void GLAPIENTRY
235 _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
236 GLenum internalformat, GLsizei width,
237 GLsizei height, GLint border, GLsizei imageSize,
238 const GLvoid *data);
239
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);
245
246 #ifdef VMS
247 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
248 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
249 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
250 #endif
251 extern void GLAPIENTRY
252 _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
253 GLsizei width, GLenum format,
254 GLsizei imageSize, const GLvoid *data);
255
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,
260 const GLvoid *data);
261
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);
267
268
269 extern void GLAPIENTRY
270 _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
271
272
273 /*@}*/
274
275 #endif