1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #ifndef FBOBJECT_H
27 #define FBOBJECT_H
28
29 #include "glheader.h"
30 #include <stdbool.h>
31
32 struct gl_context;
33 struct gl_texture_object;
34
35
36 /**
37 * Is the given FBO a user-created FBO?
38 */
39 static inline GLboolean
_mesa_is_user_fbo(const struct gl_framebuffer * fb)40 _mesa_is_user_fbo(const struct gl_framebuffer *fb)
41 {
42 return fb->Name != 0;
43 }
44
45
46 /**
47 * Is the given FBO a window system FBO (like an X window)?
48 */
49 static inline GLboolean
_mesa_is_winsys_fbo(const struct gl_framebuffer * fb)50 _mesa_is_winsys_fbo(const struct gl_framebuffer *fb)
51 {
52 return fb->Name == 0;
53 }
54
55
56
57 extern void
58 _mesa_init_fbobjects(struct gl_context *ctx);
59
60 extern struct gl_framebuffer *
61 _mesa_get_incomplete_framebuffer(void);
62
63 extern struct gl_renderbuffer *
64 _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
65
66 extern struct gl_renderbuffer *
67 _mesa_lookup_renderbuffer_err(struct gl_context *ctx, GLuint id,
68 const char *func);
69
70 extern struct gl_framebuffer *
71 _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
72
73 extern struct gl_framebuffer *
74 _mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id,
75 const char *func);
76
77
78 void
79 _mesa_update_texture_renderbuffer(struct gl_context *ctx,
80 struct gl_framebuffer *fb,
81 struct gl_renderbuffer_attachment *att);
82
83 extern void
84 _mesa_FramebufferRenderbuffer_sw(struct gl_context *ctx,
85 struct gl_framebuffer *fb,
86 GLenum attachment,
87 struct gl_renderbuffer *rb);
88
89 extern void
90 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
91 struct gl_framebuffer *fb,
92 GLenum attachment,
93 struct gl_renderbuffer *rb);
94
95 extern void
96 _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
97 GLenum internalFormat, GLsizei width,
98 GLsizei height, GLsizei samples);
99
100 extern void
101 _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
102
103 extern GLboolean
104 _mesa_has_depthstencil_combined(const struct gl_framebuffer *fb);
105
106 extern void
107 _mesa_test_framebuffer_completeness(struct gl_context *ctx,
108 struct gl_framebuffer *fb);
109
110 extern GLboolean
111 _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
112
113 extern GLenum
114 _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat);
115
116 extern bool
117 _mesa_detach_renderbuffer(struct gl_context *ctx,
118 struct gl_framebuffer *fb,
119 const void *att);
120
121 extern struct gl_renderbuffer_attachment *
122 _mesa_get_and_validate_attachment(struct gl_context *ctx,
123 struct gl_framebuffer *fb,
124 GLenum attachment, const char *caller);
125
126 extern void
127 _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
128 GLenum attachment,
129 struct gl_renderbuffer_attachment *att,
130 struct gl_texture_object *texObj, GLenum textarget,
131 GLint level, GLuint layer, GLboolean layered);
132
133 extern GLenum
134 _mesa_check_framebuffer_status(struct gl_context *ctx,
135 struct gl_framebuffer *fb);
136
137 extern void
138 _mesa_bind_framebuffers(struct gl_context *ctx,
139 struct gl_framebuffer *newDrawFb,
140 struct gl_framebuffer *newReadFb);
141
142 extern GLboolean GLAPIENTRY
143 _mesa_IsRenderbuffer(GLuint renderbuffer);
144
145 extern void GLAPIENTRY
146 _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer);
147
148 extern void GLAPIENTRY
149 _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer);
150
151 extern void GLAPIENTRY
152 _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
153
154 void GLAPIENTRY
155 _mesa_GenRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers);
156
157 extern void GLAPIENTRY
158 _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers);
159
160 void GLAPIENTRY
161 _mesa_CreateRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers);
162
163 extern void GLAPIENTRY
164 _mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers);
165
166 extern void GLAPIENTRY
167 _mesa_RenderbufferStorage(GLenum target, GLenum internalformat,
168 GLsizei width, GLsizei height);
169
170 extern void GLAPIENTRY
171 _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
172 GLenum internalformat,
173 GLsizei width, GLsizei height);
174
175 extern void GLAPIENTRY
176 _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
177 GLsizei width, GLsizei height);
178
179 extern void GLAPIENTRY
180 _mesa_NamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat,
181 GLsizei width, GLsizei height);
182
183 extern void GLAPIENTRY
184 _mesa_NamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples,
185 GLenum internalformat,
186 GLsizei width, GLsizei height);
187
188 extern void GLAPIENTRY
189 _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
190
191 extern void GLAPIENTRY
192 _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
193 GLint *params);
194
195 void GLAPIENTRY
196 _mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
197 GLint *params);
198
199 extern GLboolean GLAPIENTRY
200 _mesa_IsFramebuffer(GLuint framebuffer);
201
202 extern void GLAPIENTRY
203 _mesa_BindFramebuffer(GLenum target, GLuint framebuffer);
204
205 extern void GLAPIENTRY
206 _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer);
207
208 extern void GLAPIENTRY
209 _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
210
211 extern void GLAPIENTRY
212 _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers);
213
214 extern void GLAPIENTRY
215 _mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers);
216
217 GLenum GLAPIENTRY
218 _mesa_CheckFramebufferStatus_no_error(GLenum target);
219
220 extern GLenum GLAPIENTRY
221 _mesa_CheckFramebufferStatus(GLenum target);
222
223 extern GLenum GLAPIENTRY
224 _mesa_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);
225
226 extern void GLAPIENTRY
227 _mesa_FramebufferTexture1D_no_error(GLenum target, GLenum attachment,
228 GLenum textarget, GLuint texture,
229 GLint level);
230 extern void GLAPIENTRY
231 _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
232 GLenum textarget, GLuint texture, GLint level);
233
234 extern void GLAPIENTRY
235 _mesa_FramebufferTexture2D_no_error(GLenum target, GLenum attachment,
236 GLenum textarget, GLuint texture,
237 GLint level);
238 extern void GLAPIENTRY
239 _mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
240 GLenum textarget, GLuint texture, GLint level);
241
242 extern void GLAPIENTRY
243 _mesa_FramebufferTexture3D_no_error(GLenum target, GLenum attachment,
244 GLenum textarget, GLuint texture,
245 GLint level, GLint layer);
246 extern void GLAPIENTRY
247 _mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
248 GLenum textarget, GLuint texture,
249 GLint level, GLint layer);
250
251 extern void GLAPIENTRY
252 _mesa_FramebufferTextureLayer_no_error(GLenum target, GLenum attachment,
253 GLuint texture, GLint level,
254 GLint layer);
255 extern void GLAPIENTRY
256 _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
257 GLuint texture, GLint level, GLint layer);
258
259 extern void GLAPIENTRY
260 _mesa_NamedFramebufferTextureLayer_no_error(GLuint framebuffer,
261 GLenum attachment,
262 GLuint texture, GLint level,
263 GLint layer);
264 extern void GLAPIENTRY
265 _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment,
266 GLuint texture, GLint level, GLint layer);
267
268 extern void GLAPIENTRY
269 _mesa_FramebufferTexture_no_error(GLenum target, GLenum attachment,
270 GLuint texture, GLint level);
271 extern void GLAPIENTRY
272 _mesa_FramebufferTexture(GLenum target, GLenum attachment,
273 GLuint texture, GLint level);
274
275 extern void GLAPIENTRY
276 _mesa_NamedFramebufferTexture_no_error(GLuint framebuffer, GLenum attachment,
277 GLuint texture, GLint level);
278 extern void GLAPIENTRY
279 _mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment,
280 GLuint texture, GLint level);
281
282 void GLAPIENTRY
283 _mesa_FramebufferRenderbuffer_no_error(GLenum target, GLenum attachment,
284 GLenum renderbuffertarget,
285 GLuint renderbuffer);
286
287 extern void GLAPIENTRY
288 _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
289 GLenum renderbuffertarget,
290 GLuint renderbuffer);
291
292 void GLAPIENTRY
293 _mesa_NamedFramebufferRenderbuffer_no_error(GLuint framebuffer,
294 GLenum attachment,
295 GLenum renderbuffertarget,
296 GLuint renderbuffer);
297
298 extern void GLAPIENTRY
299 _mesa_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment,
300 GLenum renderbuffertarget,
301 GLuint renderbuffer);
302
303 extern void GLAPIENTRY
304 _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
305 GLenum pname, GLint *params);
306 extern void GLAPIENTRY
307 _mesa_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,
308 GLenum attachment,
309 GLenum pname, GLint *params);
310
311 extern void GLAPIENTRY
312 _mesa_NamedFramebufferParameteri(GLuint framebuffer, GLenum pname,
313 GLint param);
314
315 extern void GLAPIENTRY
316 _mesa_GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname,
317 GLint *param);
318
319 void GLAPIENTRY
320 _mesa_InvalidateSubFramebuffer_no_error(GLenum target, GLsizei numAttachments,
321 const GLenum *attachments, GLint x,
322 GLint y, GLsizei width, GLsizei height);
323
324 extern void GLAPIENTRY
325 _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
326 const GLenum *attachments, GLint x, GLint y,
327 GLsizei width, GLsizei height);
328
329 extern void GLAPIENTRY
330 _mesa_InvalidateNamedFramebufferSubData(GLuint framebuffer,
331 GLsizei numAttachments,
332 const GLenum *attachments,
333 GLint x, GLint y,
334 GLsizei width, GLsizei height);
335 void GLAPIENTRY
336 _mesa_InvalidateFramebuffer_no_error(GLenum target, GLsizei numAttachments,
337 const GLenum *attachments);
338
339 extern void GLAPIENTRY
340 _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
341 const GLenum *attachments);
342
343 extern void GLAPIENTRY
344 _mesa_InvalidateNamedFramebufferData(GLuint framebuffer,
345 GLsizei numAttachments,
346 const GLenum *attachments);
347
348 extern void GLAPIENTRY
349 _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
350 const GLenum *attachments);
351
352 extern void GLAPIENTRY
353 _mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param);
354
355 extern void GLAPIENTRY
356 _mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
357
358 #endif /* FBOBJECT_H */
359