mesa: rename the AMD_conservative_depth extension flag to ARB
[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
84 extern void
85 _mesa_clear_texture_image(struct gl_context *ctx,
86 struct gl_texture_image *texImage);
87
88
89 extern void
90 _mesa_set_tex_image(struct gl_texture_object *tObj,
91 GLenum target, GLint level,
92 struct gl_texture_image *texImage);
93
94
95 extern struct gl_texture_object *
96 _mesa_select_tex_object(struct gl_context *ctx,
97 const struct gl_texture_unit *texUnit,
98 GLenum target);
99
100 extern struct gl_texture_object *
101 _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target);
102
103
104 extern struct gl_texture_image *
105 _mesa_select_tex_image(struct gl_context *ctx,
106 const struct gl_texture_object *texObj,
107 GLenum target, GLint level);
108
109
110 extern struct gl_texture_image *
111 _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
112 GLenum target, GLint level);
113
114
115 extern struct gl_texture_image *
116 _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
117
118
119 extern GLint
120 _mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
121
122
123 extern GLboolean
124 _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
125 GLint internalFormat, GLenum format, GLenum type,
126 GLint width, GLint height, GLint depth, GLint border);
127
128
129 extern GLuint
130 _mesa_tex_target_to_face(GLenum target);
131
132 extern GLint
133 _mesa_get_texture_dimensions(GLenum target);
134
135 /**
136 * Lock a texture for updating. See also _mesa_lock_context_textures().
137 */
138 static inline void
139 _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
140 {
141 _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
142 ctx->Shared->TextureStateStamp++;
143 (void) texObj;
144 }
145
146 static inline void
147 _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
148 {
149 (void) texObj;
150 _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
151 }
152
153 /*@}*/
154
155
156 /** \name API entry point functions */
157 /*@{*/
158
159 extern void GLAPIENTRY
160 _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
161 GLsizei width, GLint border,
162 GLenum format, GLenum type, const GLvoid *pixels );
163
164
165 extern void GLAPIENTRY
166 _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
167 GLsizei width, GLsizei height, GLint border,
168 GLenum format, GLenum type, const GLvoid *pixels );
169
170
171 extern void GLAPIENTRY
172 _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
173 GLsizei width, GLsizei height, GLsizei depth, GLint border,
174 GLenum format, GLenum type, const GLvoid *pixels );
175
176
177 extern void GLAPIENTRY
178 _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
179 GLsizei width, GLsizei height, GLsizei depth,
180 GLint border, GLenum format, GLenum type,
181 const GLvoid *pixels );
182
183 extern void GLAPIENTRY
184 _mesa_EGLImageTargetTexture2DOES( GLenum target, GLeglImageOES image );
185
186 extern void GLAPIENTRY
187 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
188 GLsizei width,
189 GLenum format, GLenum type,
190 const GLvoid *pixels );
191
192
193 extern void GLAPIENTRY
194 _mesa_TexSubImage2D( GLenum target, GLint level,
195 GLint xoffset, GLint yoffset,
196 GLsizei width, GLsizei height,
197 GLenum format, GLenum type,
198 const GLvoid *pixels );
199
200
201 extern void GLAPIENTRY
202 _mesa_TexSubImage3D( GLenum target, GLint level,
203 GLint xoffset, GLint yoffset, GLint zoffset,
204 GLsizei width, GLsizei height, GLsizei depth,
205 GLenum format, GLenum type,
206 const GLvoid *pixels );
207
208
209 extern void GLAPIENTRY
210 _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
211 GLint x, GLint y, GLsizei width, GLint border );
212
213
214 extern void GLAPIENTRY
215 _mesa_CopyTexImage2D( GLenum target, GLint level,
216 GLenum internalformat, GLint x, GLint y,
217 GLsizei width, GLsizei height, GLint border );
218
219
220 extern void GLAPIENTRY
221 _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
222 GLint x, GLint y, GLsizei width );
223
224
225 extern void GLAPIENTRY
226 _mesa_CopyTexSubImage2D( GLenum target, GLint level,
227 GLint xoffset, GLint yoffset,
228 GLint x, GLint y, GLsizei width, GLsizei height );
229
230
231 extern void GLAPIENTRY
232 _mesa_CopyTexSubImage3D( GLenum target, GLint level,
233 GLint xoffset, GLint yoffset, GLint zoffset,
234 GLint x, GLint y, GLsizei width, GLsizei height );
235
236
237
238 extern void GLAPIENTRY
239 _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
240 GLenum internalformat, GLsizei width,
241 GLint border, GLsizei imageSize,
242 const GLvoid *data);
243
244 extern void GLAPIENTRY
245 _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
246 GLenum internalformat, GLsizei width,
247 GLsizei height, GLint border, GLsizei imageSize,
248 const GLvoid *data);
249
250 extern void GLAPIENTRY
251 _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
252 GLenum internalformat, GLsizei width,
253 GLsizei height, GLsizei depth, GLint border,
254 GLsizei imageSize, const GLvoid *data);
255
256 #ifdef VMS
257 #define _mesa_CompressedTexSubImage1DARB _mesa_CompressedTexSubImage1DAR
258 #define _mesa_CompressedTexSubImage2DARB _mesa_CompressedTexSubImage2DAR
259 #define _mesa_CompressedTexSubImage3DARB _mesa_CompressedTexSubImage3DAR
260 #endif
261 extern void GLAPIENTRY
262 _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
263 GLsizei width, GLenum format,
264 GLsizei imageSize, const GLvoid *data);
265
266 extern void GLAPIENTRY
267 _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
268 GLint yoffset, GLsizei width, GLsizei height,
269 GLenum format, GLsizei imageSize,
270 const GLvoid *data);
271
272 extern void GLAPIENTRY
273 _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
274 GLint yoffset, GLint zoffset, GLsizei width,
275 GLsizei height, GLsizei depth, GLenum format,
276 GLsizei imageSize, const GLvoid *data);
277
278
279 extern void GLAPIENTRY
280 _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
281
282
283 /*@}*/
284
285 #endif