mesa: Restore 78-column wrapping of license text in C-style comments.
[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 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31
32 #ifndef TEXIMAGE_H
33 #define TEXIMAGE_H
34
35
36 #include "mtypes.h"
37 #include "formats.h"
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /** Is the given value one of the 6 cube faces? */
44 static inline GLboolean
45 _mesa_is_cube_face(GLenum target)
46 {
47 return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&
48 target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
49 }
50
51 /** Is any of the dimensions of given texture equal to zero? */
52 static inline GLboolean
53 _mesa_is_zero_size_texture(const struct gl_texture_image *texImage)
54 {
55 return (texImage->Width == 0 ||
56 texImage->Height == 0 ||
57 texImage->Depth == 0);
58 }
59
60 /** \name Internal functions */
61 /*@{*/
62
63 extern GLint
64 _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
65
66
67 extern GLboolean
68 _mesa_is_proxy_texture(GLenum target);
69
70 extern GLenum
71 _mesa_get_proxy_target(GLenum target);
72
73 extern struct gl_texture_image *
74 _mesa_new_texture_image( struct gl_context *ctx );
75
76
77 extern void
78 _mesa_delete_texture_image( struct gl_context *ctx,
79 struct gl_texture_image *teximage );
80
81
82 extern void
83 _mesa_init_teximage_fields(struct gl_context *ctx,
84 struct gl_texture_image *img,
85 GLsizei width, GLsizei height, GLsizei depth,
86 GLint border, GLenum internalFormat,
87 gl_format format);
88
89
90 extern gl_format
91 _mesa_choose_texture_format(struct gl_context *ctx,
92 struct gl_texture_object *texObj,
93 GLenum target, GLint level,
94 GLenum internalFormat, GLenum format, GLenum type);
95
96 extern void
97 _mesa_update_fbo_texture(struct gl_context *ctx,
98 struct gl_texture_object *texObj,
99 GLuint face, GLuint level);
100
101 extern void
102 _mesa_clear_texture_image(struct gl_context *ctx,
103 struct gl_texture_image *texImage);
104
105
106 extern struct gl_texture_object *
107 _mesa_select_tex_object(struct gl_context *ctx,
108 const struct gl_texture_unit *texUnit,
109 GLenum target);
110
111 extern struct gl_texture_object *
112 _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target);
113
114
115 extern struct gl_texture_image *
116 _mesa_select_tex_image(struct gl_context *ctx,
117 const struct gl_texture_object *texObj,
118 GLenum target, GLint level);
119
120
121 extern struct gl_texture_image *
122 _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
123 GLenum target, GLint level);
124
125
126 extern GLint
127 _mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
128
129
130 extern GLboolean
131 _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
132 gl_format format,
133 GLint width, GLint height, GLint depth, GLint border);
134
135
136 extern GLuint
137 _mesa_tex_target_to_face(GLenum target);
138
139 extern GLint
140 _mesa_get_texture_dimensions(GLenum target);
141
142 extern GLsizei
143 _mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height,
144 GLsizei depth);
145
146 extern GLboolean
147 _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target,
148 GLint level, GLint width, GLint height,
149 GLint depth, GLint border);
150
151 /**
152 * Lock a texture for updating. See also _mesa_lock_context_textures().
153 */
154 static inline void
155 _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
156 {
157 _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
158 ctx->Shared->TextureStateStamp++;
159 (void) texObj;
160 }
161
162 static inline void
163 _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
164 {
165 (void) texObj;
166 _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
167 }
168
169 /*@}*/
170
171
172 /** \name API entry point functions */
173 /*@{*/
174
175 extern void GLAPIENTRY
176 _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
177 GLsizei width, GLint border,
178 GLenum format, GLenum type, const GLvoid *pixels );
179
180
181 extern void GLAPIENTRY
182 _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
183 GLsizei width, GLsizei height, GLint border,
184 GLenum format, GLenum type, const GLvoid *pixels );
185
186
187 extern void GLAPIENTRY
188 _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
189 GLsizei width, GLsizei height, GLsizei depth, GLint border,
190 GLenum format, GLenum type, const GLvoid *pixels );
191
192
193 extern void GLAPIENTRY
194 _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
195 GLsizei width, GLsizei height, GLsizei depth,
196 GLint border, GLenum format, GLenum type,
197 const GLvoid *pixels );
198
199 extern void GLAPIENTRY
200 _mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
201
202 extern void GLAPIENTRY
203 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
204 GLsizei width,
205 GLenum format, GLenum type,
206 const GLvoid *pixels );
207
208
209 extern void GLAPIENTRY
210 _mesa_TexSubImage2D( GLenum target, GLint level,
211 GLint xoffset, GLint yoffset,
212 GLsizei width, GLsizei height,
213 GLenum format, GLenum type,
214 const GLvoid *pixels );
215
216
217 extern void GLAPIENTRY
218 _mesa_TexSubImage3D( GLenum target, GLint level,
219 GLint xoffset, GLint yoffset, GLint zoffset,
220 GLsizei width, GLsizei height, GLsizei depth,
221 GLenum format, GLenum type,
222 const GLvoid *pixels );
223
224
225 extern void GLAPIENTRY
226 _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
227 GLint x, GLint y, GLsizei width, GLint border );
228
229
230 extern void GLAPIENTRY
231 _mesa_CopyTexImage2D( GLenum target, GLint level,
232 GLenum internalformat, GLint x, GLint y,
233 GLsizei width, GLsizei height, GLint border );
234
235
236 extern void GLAPIENTRY
237 _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
238 GLint x, GLint y, GLsizei width );
239
240
241 extern void GLAPIENTRY
242 _mesa_CopyTexSubImage2D( GLenum target, GLint level,
243 GLint xoffset, GLint yoffset,
244 GLint x, GLint y, GLsizei width, GLsizei height );
245
246
247 extern void GLAPIENTRY
248 _mesa_CopyTexSubImage3D( GLenum target, GLint level,
249 GLint xoffset, GLint yoffset, GLint zoffset,
250 GLint x, GLint y, GLsizei width, GLsizei height );
251
252
253
254 extern void GLAPIENTRY
255 _mesa_CompressedTexImage1D(GLenum target, GLint level,
256 GLenum internalformat, GLsizei width,
257 GLint border, GLsizei imageSize,
258 const GLvoid *data);
259
260 extern void GLAPIENTRY
261 _mesa_CompressedTexImage2D(GLenum target, GLint level,
262 GLenum internalformat, GLsizei width,
263 GLsizei height, GLint border, GLsizei imageSize,
264 const GLvoid *data);
265
266 extern void GLAPIENTRY
267 _mesa_CompressedTexImage3D(GLenum target, GLint level,
268 GLenum internalformat, GLsizei width,
269 GLsizei height, GLsizei depth, GLint border,
270 GLsizei imageSize, const GLvoid *data);
271
272 extern void GLAPIENTRY
273 _mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset,
274 GLsizei width, GLenum format,
275 GLsizei imageSize, const GLvoid *data);
276
277 extern void GLAPIENTRY
278 _mesa_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset,
279 GLint yoffset, GLsizei width, GLsizei height,
280 GLenum format, GLsizei imageSize,
281 const GLvoid *data);
282
283 extern void GLAPIENTRY
284 _mesa_CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset,
285 GLint yoffset, GLint zoffset, GLsizei width,
286 GLsizei height, GLsizei depth, GLenum format,
287 GLsizei imageSize, const GLvoid *data);
288
289
290 extern void GLAPIENTRY
291 _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
292
293 extern void GLAPIENTRY
294 _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer,
295 GLintptr offset, GLsizeiptr size);
296
297
298 extern void GLAPIENTRY
299 _mesa_TexImage2DMultisample(GLenum target, GLsizei samples,
300 GLint internalformat, GLsizei width,
301 GLsizei height, GLboolean fixedsamplelocations);
302
303 extern void GLAPIENTRY
304 _mesa_TexImage3DMultisample(GLenum target, GLsizei samples,
305 GLint internalformat, GLsizei width,
306 GLsizei height, GLsizei depth,
307 GLboolean fixedsamplelocations);
308
309 extern void GLAPIENTRY
310 _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples,
311 GLenum internalformat, GLsizei width,
312 GLsizei height, GLboolean fixedsamplelocations);
313
314 extern void GLAPIENTRY
315 _mesa_TexStorage3DMultisample(GLenum target, GLsizei samples,
316 GLenum internalformat, GLsizei width,
317 GLsizei height, GLsizei depth,
318 GLboolean fixedsamplelocations);
319
320 /*@}*/
321
322 #ifdef __cplusplus
323 }
324 #endif
325
326 #endif