[MSHTML_WINETEST]
[reactos.git] / reactos / dll / opengl / 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 /** Is any of the dimensions of given texture equal to zero? */
48 static inline GLboolean
49 _mesa_is_zero_size_texture(const struct gl_texture_image *texImage)
50 {
51 return (texImage->Width == 0 ||
52 texImage->Height == 0 ||
53 texImage->Depth == 0);
54 }
55
56 /** \name Internal functions */
57 /*@{*/
58
59 extern GLint
60 _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
61
62
63 extern GLboolean
64 _mesa_is_proxy_texture(GLenum target);
65
66
67 extern struct gl_texture_image *
68 _mesa_new_texture_image( struct gl_context *ctx );
69
70
71 extern void
72 _mesa_delete_texture_image( struct gl_context *ctx,
73 struct gl_texture_image *teximage );
74
75
76 extern void
77 _mesa_init_teximage_fields(struct gl_context *ctx,
78 struct gl_texture_image *img,
79 GLsizei width, GLsizei height, GLsizei depth,
80 GLint border, GLenum internalFormat,
81 gl_format format);
82
83
84 extern gl_format
85 _mesa_choose_texture_format(struct gl_context *ctx,
86 struct gl_texture_object *texObj,
87 GLenum target, GLint level,
88 GLenum internalFormat, GLenum format, GLenum type);
89
90 extern void
91 _mesa_clear_texture_image(struct gl_context *ctx,
92 struct gl_texture_image *texImage);
93
94
95 extern struct gl_texture_object *
96 _mesa_select_tex_object(struct gl_context *ctx,
97 GLenum target);
98
99
100 extern struct gl_texture_image *
101 _mesa_select_tex_image(struct gl_context *ctx,
102 const struct gl_texture_object *texObj,
103 GLenum target, GLint level);
104
105
106 extern struct gl_texture_image *
107 _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
108 GLenum target, GLint level);
109
110
111 extern struct gl_texture_image *
112 _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
113
114
115 extern GLint
116 _mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
117
118
119 extern GLboolean
120 _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
121 GLint internalFormat, GLenum format, GLenum type,
122 GLint width, GLint height, GLint depth, GLint border);
123
124
125 extern GLuint
126 _mesa_tex_target_to_face(GLenum target);
127
128 extern GLint
129 _mesa_get_texture_dimensions(GLenum target);
130
131 /**
132 * Lock a texture for updating. See also _mesa_lock_context_textures().
133 */
134 static inline void
135 _mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
136 {
137 _glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
138 ctx->Shared->TextureStateStamp++;
139 (void) texObj;
140 }
141
142 static inline void
143 _mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
144 {
145 (void) texObj;
146 _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
147 }
148
149 /*@}*/
150
151
152 /** \name API entry point functions */
153 /*@{*/
154
155 extern void GLAPIENTRY
156 _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat,
157 GLsizei width, GLint border,
158 GLenum format, GLenum type, const GLvoid *pixels );
159
160
161 extern void GLAPIENTRY
162 _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
163 GLsizei width, GLsizei height, GLint border,
164 GLenum format, GLenum type, const GLvoid *pixels );
165
166
167 extern void GLAPIENTRY
168 _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
169 GLsizei width, GLsizei height, GLsizei depth, GLint border,
170 GLenum format, GLenum type, const GLvoid *pixels );
171
172
173 extern void GLAPIENTRY
174 _mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
175 GLsizei width, GLsizei height, GLsizei depth,
176 GLint border, GLenum format, GLenum type,
177 const GLvoid *pixels );
178
179 extern void GLAPIENTRY
180 _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
181 GLsizei width,
182 GLenum format, GLenum type,
183 const GLvoid *pixels );
184
185
186 extern void GLAPIENTRY
187 _mesa_TexSubImage2D( GLenum target, GLint level,
188 GLint xoffset, GLint yoffset,
189 GLsizei width, GLsizei height,
190 GLenum format, GLenum type,
191 const GLvoid *pixels );
192
193
194 extern void GLAPIENTRY
195 _mesa_TexSubImage3D( GLenum target, GLint level,
196 GLint xoffset, GLint yoffset, GLint zoffset,
197 GLsizei width, GLsizei height, GLsizei depth,
198 GLenum format, GLenum type,
199 const GLvoid *pixels );
200
201
202 extern void GLAPIENTRY
203 _mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
204 GLint x, GLint y, GLsizei width, GLint border );
205
206
207 extern void GLAPIENTRY
208 _mesa_CopyTexImage2D( GLenum target, GLint level,
209 GLenum internalformat, GLint x, GLint y,
210 GLsizei width, GLsizei height, GLint border );
211
212
213 extern void GLAPIENTRY
214 _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset,
215 GLint x, GLint y, GLsizei width );
216
217
218 extern void GLAPIENTRY
219 _mesa_CopyTexSubImage2D( GLenum target, GLint level,
220 GLint xoffset, GLint yoffset,
221 GLint x, GLint y, GLsizei width, GLsizei height );
222
223
224 extern void GLAPIENTRY
225 _mesa_CopyTexSubImage3D( GLenum target, GLint level,
226 GLint xoffset, GLint yoffset, GLint zoffset,
227 GLint x, GLint y, GLsizei width, GLsizei height );
228
229 /*@}*/
230
231 #endif