mesa: make update_fbo_texture() non-static
[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 /** Is the given value one of the 6 cube faces? */
40 static inline GLboolean
41 _mesa_is_cube_face(GLenum target)
42 {
43 return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
44 target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
45 }
46
47
48
49 /** \name Internal functions */
50 /*@{*/
51
52 extern GLint
53 _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
54
55
56 extern GLboolean
57 _mesa_is_proxy_texture(GLenum target);
58
59
60 extern struct gl_texture_image *
61 _mesa_new_texture_image( struct gl_context *ctx );
62
63
64 extern void
65 _mesa_delete_texture_image( struct gl_context *ctx,
66 struct gl_texture_image *teximage );
67
68
69 extern void
70 _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
71 struct gl_texture_image *img,
72 GLsizei width, GLsizei height, GLsizei depth,
73 GLint border, GLenum internalFormat,
74 gl_format format);
75
76
77 extern gl_format
78 _mesa_choose_texture_format(struct gl_context *ctx,
79 struct gl_texture_object *texObj,
80 GLenum target, GLint level,
81 GLenum internalFormat, GLenum format, GLenum type);
82
83 extern void
84 _mesa_update_fbo_texture(struct gl_context *ctx,
85 struct gl_texture_object *texObj,
86 GLuint face, GLuint level);
87
88 extern void
89 _mesa_clear_texture_image(struct gl_context *ctx,
90 struct gl_texture_image *texImage);
91
92
93 extern void
94 _mesa_set_tex_image(struct gl_texture_object *tObj,
95 GLenum target, GLint level,
96 struct gl_texture_image *texImage);
97
98
99 extern struct gl_texture_object *
100 _mesa_select_tex_object(struct gl_context *ctx,
101 const struct gl_texture_unit *texUnit,
102 GLenum target);
103
104 extern struct gl_texture_object *
105 _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target);
106
107
108 extern struct gl_texture_image *
109 _mesa_select_tex_image(struct gl_context *ctx,
110 const struct gl_texture_object *texObj,
111 GLenum target, GLint level);
112
113
114 extern struct gl_texture_image *
115 _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
116 GLenum target, GLint level);
117
118
119 extern struct gl_texture_image *
120 _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
121
122
123 extern GLint
124 _mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
125
126
127 extern GLboolean
128 _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
129 GLint internalFormat, GLenum format, GLenum type,
130 GLint width, GLint height, GLint depth, GLint border);
131
132
133 extern GLuint
134 _mesa_tex_target_to_face(GLenum target);
135
136 extern GLint
137 _mesa_get_texture_dimensions(GLenum target);
138
139 /**
140 * Lock a texture for updating. See also _mesa_lock_context_textures().
141 */
142 static inline void
143 _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
144 {
145 _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
146 ctx->Shared->TextureStateStamp++;
147 (void) texObj;
148 }
149
150 static inline void
151 _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
152 {
153 (void) texObj;
154 _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
155 }
156
157 /*@}*/
158
159
160 /** \name API entry point functions */
161 /*@{*/
162
163 extern void GLAPIENTRY
164 _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
165 GLsizei width, GLint border,
166 GLenum format, GLenum type, const GLvoid *pixels );
167
168
169 extern void GLAPIENTRY
170 _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
171 GLsizei width, GLsizei height, GLint border,
172 GLenum format, GLenum type, const GLvoid *pixels );
173
174
175 extern void GLAPIENTRY
176 _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
177 GLsizei width, GLsizei height, GLsizei depth, GLint border,
178 GLenum format, GLenum type, const GLvoid *pixels );
179
180
181 extern void GLAPIENTRY
182 _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
183 GLsizei width, GLsizei height, GLsizei depth,
184 GLint border, GLenum format, GLenum type,
185 const GLvoid *pixels );
186
187 extern void GLAPIENTRY
188 _mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
189
190 extern void GLAPIENTRY
191 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
192 GLsizei width,
193 GLenum format, GLenum type,
194 const GLvoid *pixels );
195
196
197 extern void GLAPIENTRY
198 _mesa_TexSubImage2D( GLenum target, GLint level,
199 GLint xoffset, GLint yoffset,
200 GLsizei width, GLsizei height,
201 GLenum format, GLenum type,
202 const GLvoid *pixels );
203
204
205 extern void GLAPIENTRY
206 _mesa_TexSubImage3D( GLenum target, GLint level,
207 GLint xoffset, GLint yoffset, GLint zoffset,
208 GLsizei width, GLsizei height, GLsizei depth,
209 GLenum format, GLenum type,
210 const GLvoid *pixels );
211
212
213 extern void GLAPIENTRY
214 _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
215 GLint x, GLint y, GLsizei width, GLint border );
216
217
218 extern void GLAPIENTRY
219 _mesa_CopyTexImage2D( GLenum target, GLint level,
220 GLenum internalformat, GLint x, GLint y,
221 GLsizei width, GLsizei height, GLint border );
222
223
224 extern void GLAPIENTRY
225 _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
226 GLint x, GLint y, GLsizei width );
227
228
229 extern void GLAPIENTRY
230 _mesa_CopyTexSubImage2D( GLenum target, GLint level,
231 GLint xoffset, GLint yoffset,
232 GLint x, GLint y, GLsizei width, GLsizei height );
233
234
235 extern void GLAPIENTRY
236 _mesa_CopyTexSubImage3D( GLenum target, GLint level,
237 GLint xoffset, GLint yoffset, GLint zoffset,
238 GLint x, GLint y, GLsizei width, GLsizei height );
239
240
241
242 extern void GLAPIENTRY
243 _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
244 GLenum internalformat, GLsizei width,
245 GLint border, GLsizei imageSize,
246 const GLvoid *data);
247
248 extern void GLAPIENTRY
249 _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
250 GLenum internalformat, GLsizei width,
251 GLsizei height, GLint border, GLsizei imageSize,
252 const GLvoid *data);
253
254 extern void GLAPIENTRY
255 _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
256 GLenum internalformat, GLsizei width,
257 GLsizei height, GLsizei depth, GLint border,
258 GLsizei imageSize, const GLvoid *data);
259
260 #ifdef VMS
261 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
262 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
263 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
264 #endif
265 extern void GLAPIENTRY
266 _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
267 GLsizei width, GLenum format,
268 GLsizei imageSize, const GLvoid *data);
269
270 extern void GLAPIENTRY
271 _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
272 GLint yoffset, GLsizei width, GLsizei height,
273 GLenum format, GLsizei imageSize,
274 const GLvoid *data);
275
276 extern void GLAPIENTRY
277 _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
278 GLint yoffset, GLint zoffset, GLsizei width,
279 GLsizei height, GLsizei depth, GLenum format,
280 GLsizei imageSize, const GLvoid *data);
281
282
283 extern void GLAPIENTRY
284 _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
285
286
287 /*@}*/
288
289 #endif