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 struct gl_framebuffer *
78 _mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id,
79 const char* func);
80
81
82 void
83 _mesa_update_texture_renderbuffer(struct gl_context *ctx,
84 struct gl_framebuffer *fb,
85 struct gl_renderbuffer_attachment *att);
86
87 extern void
88 _mesa_FramebufferRenderbuffer_sw(struct gl_context *ctx,
89 struct gl_framebuffer *fb,
90 GLenum attachment,
91 struct gl_renderbuffer *rb);
92
93 extern void
94 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
95 struct gl_framebuffer *fb,
96 GLenum attachment,
97 struct gl_renderbuffer *rb);
98
99 extern void
100 _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
101 GLenum internalFormat, GLsizei width,
102 GLsizei height, GLsizei samples,
103 GLsizei storageSamples);
104
105 extern void
106 _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
107
108 extern GLboolean
109 _mesa_has_depthstencil_combined(const struct gl_framebuffer *fb);
110
111 extern void
112 _mesa_test_framebuffer_completeness(struct gl_context *ctx,
113 struct gl_framebuffer *fb);
114
115 extern GLboolean
116 _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
117
118 extern GLenum
119 _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat);
120
121 extern bool
122 _mesa_detach_renderbuffer(struct gl_context *ctx,
123 struct gl_framebuffer *fb,
124 const void *att);
125
126 extern struct gl_renderbuffer_attachment *
127 _mesa_get_and_validate_attachment(struct gl_context *ctx,
128 struct gl_framebuffer *fb,
129 GLenum attachment, const char *caller);
130
131 extern void
132 _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
133 GLenum attachment,
134 struct gl_renderbuffer_attachment *att,
135 struct gl_texture_object *texObj, GLenum textarget,
136 GLint level, GLsizei samples,
137 GLuint layer, GLboolean layered);
138
139 extern GLenum
140 _mesa_check_framebuffer_status(struct gl_context *ctx,
141 struct gl_framebuffer *fb);
142
143 extern void
144 _mesa_bind_framebuffers(struct gl_context *ctx,
145 struct gl_framebuffer *newDrawFb,
146 struct gl_framebuffer *newReadFb);
147
148 extern GLboolean GLAPIENTRY
149 _mesa_IsRenderbuffer(GLuint renderbuffer);
150
151 extern void GLAPIENTRY
152 _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer);
153
154 extern void GLAPIENTRY
155 _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer);
156
157 extern void GLAPIENTRY
158 _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
159
160 void GLAPIENTRY
161 _mesa_GenRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers);
162
163 extern void GLAPIENTRY
164 _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers);
165
166 void GLAPIENTRY
167 _mesa_CreateRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers);
168
169 extern void GLAPIENTRY
170 _mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers);
171
172 extern void GLAPIENTRY
173 _mesa_RenderbufferStorage(GLenum target, GLenum internalformat,
174 GLsizei width, GLsizei height);
175
176 extern void GLAPIENTRY
177 _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
178 GLenum internalformat,
179 GLsizei width, GLsizei height);
180
181 extern void GLAPIENTRY
182 _mesa_RenderbufferStorageMultisampleAdvancedAMD(
183 GLenum target, GLsizei samples, GLsizei storageSamples,
184 GLenum internalFormat, GLsizei width, GLsizei height);
185
186 extern void GLAPIENTRY
187 _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
188 GLsizei width, GLsizei height);
189
190 extern void GLAPIENTRY
191 _mesa_NamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat,
192 GLsizei width, GLsizei height);
193 extern void GLAPIENTRY
194 _mesa_NamedRenderbufferStorageEXT(GLuint renderbuffer, GLenum internalformat,
195 GLsizei width, GLsizei height);
196
197 extern void GLAPIENTRY
198 _mesa_NamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples,
199 GLenum internalformat,
200 GLsizei width, GLsizei height);
201
202 extern void GLAPIENTRY
203 _mesa_NamedRenderbufferStorageMultisampleEXT(GLuint renderbuffer, GLsizei samples,
204 GLenum internalformat,
205 GLsizei width, GLsizei height);
206
207 extern void GLAPIENTRY
208 _mesa_NamedRenderbufferStorageMultisampleAdvancedAMD(
209 GLuint renderbuffer, GLsizei samples, GLsizei storageSamples,
210 GLenum internalformat, GLsizei width, GLsizei height);
211
212 extern void GLAPIENTRY
213 _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
214
215 extern void GLAPIENTRY
216 _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
217 GLint *params);
218
219 void GLAPIENTRY
220 _mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname,
221 GLint *params);
222
223 extern GLboolean GLAPIENTRY
224 _mesa_IsFramebuffer(GLuint framebuffer);
225
226 extern void GLAPIENTRY
227 _mesa_BindFramebuffer(GLenum target, GLuint framebuffer);
228
229 extern void GLAPIENTRY
230 _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer);
231
232 extern void GLAPIENTRY
233 _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
234
235 extern void GLAPIENTRY
236 _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers);
237
238 extern void GLAPIENTRY
239 _mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers);
240
241 GLenum GLAPIENTRY
242 _mesa_CheckFramebufferStatus_no_error(GLenum target);
243
244 extern GLenum GLAPIENTRY
245 _mesa_CheckFramebufferStatus(GLenum target);
246
247 extern GLenum GLAPIENTRY
248 _mesa_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);
249
250 extern GLenum GLAPIENTRY
251 _mesa_CheckNamedFramebufferStatusEXT(GLuint framebuffer, GLenum target);
252
253 extern void GLAPIENTRY
254 _mesa_FramebufferTexture1D_no_error(GLenum target, GLenum attachment,
255 GLenum textarget, GLuint texture,
256 GLint level);
257 extern void GLAPIENTRY
258 _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
259 GLenum textarget, GLuint texture, GLint level);
260
261 extern void GLAPIENTRY
262 _mesa_FramebufferTexture2D_no_error(GLenum target, GLenum attachment,
263 GLenum textarget, GLuint texture,
264 GLint level);
265 extern void GLAPIENTRY
266 _mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
267 GLenum textarget, GLuint texture, GLint level);
268
269 void GLAPIENTRY
270 _mesa_FramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment,
271 GLenum textarget, GLuint texture,
272 GLint level, GLsizei samples);
273
274 extern void GLAPIENTRY
275 _mesa_FramebufferTexture3D_no_error(GLenum target, GLenum attachment,
276 GLenum textarget, GLuint texture,
277 GLint level, GLint layer);
278 extern void GLAPIENTRY
279 _mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
280 GLenum textarget, GLuint texture,
281 GLint level, GLint layer);
282
283 extern void GLAPIENTRY
284 _mesa_FramebufferTextureLayer_no_error(GLenum target, GLenum attachment,
285 GLuint texture, GLint level,
286 GLint layer);
287 extern void GLAPIENTRY
288 _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
289 GLuint texture, GLint level, GLint layer);
290
291 extern void GLAPIENTRY
292 _mesa_NamedFramebufferTextureLayer_no_error(GLuint framebuffer,
293 GLenum attachment,
294 GLuint texture, GLint level,
295 GLint layer);
296 extern void GLAPIENTRY
297 _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment,
298 GLuint texture, GLint level, GLint layer);
299
300 extern void GLAPIENTRY
301 _mesa_FramebufferTexture_no_error(GLenum target, GLenum attachment,
302 GLuint texture, GLint level);
303 extern void GLAPIENTRY
304 _mesa_FramebufferTexture(GLenum target, GLenum attachment,
305 GLuint texture, GLint level);
306
307 extern void GLAPIENTRY
308 _mesa_NamedFramebufferTexture_no_error(GLuint framebuffer, GLenum attachment,
309 GLuint texture, GLint level);
310 extern void GLAPIENTRY
311 _mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment,
312 GLuint texture, GLint level);
313
314 extern void GLAPIENTRY
315 _mesa_NamedFramebufferRenderbufferEXT(GLuint framebuffer, GLenum attachment,
316 GLenum renderbuffertarget,
317 GLuint renderbuffer);
318
319 extern void GLAPIENTRY
320 _mesa_NamedFramebufferTexture1DEXT(GLuint framebuffer, GLenum attachment,
321 GLenum textarget, GLuint texture, GLint level);
322
323 extern void GLAPIENTRY
324 _mesa_NamedFramebufferTexture2DEXT(GLuint framebuffer, GLenum attachment,
325 GLenum textarget, GLuint texture, GLint level);
326
327 extern void GLAPIENTRY
328 _mesa_NamedFramebufferTexture3DEXT(GLuint framebuffer, GLenum attachment,
329 GLenum textarget, GLuint texture,
330 GLint level, GLint zoffset);
331
332 void GLAPIENTRY
333 _mesa_FramebufferRenderbuffer_no_error(GLenum target, GLenum attachment,
334 GLenum renderbuffertarget,
335 GLuint renderbuffer);
336
337 extern void GLAPIENTRY
338 _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
339 GLenum renderbuffertarget,
340 GLuint renderbuffer);
341
342 void GLAPIENTRY
343 _mesa_NamedFramebufferRenderbuffer_no_error(GLuint framebuffer,
344 GLenum attachment,
345 GLenum renderbuffertarget,
346 GLuint renderbuffer);
347
348 extern void GLAPIENTRY
349 _mesa_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment,
350 GLenum renderbuffertarget,
351 GLuint renderbuffer);
352
353 extern void GLAPIENTRY
354 _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
355 GLenum pname, GLint *params);
356
357 extern void GLAPIENTRY
358 _mesa_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer,
359 GLenum attachment,
360 GLenum pname, GLint *params);
361
362 extern void GLAPIENTRY
363 _mesa_GetNamedFramebufferAttachmentParameterivEXT(GLuint framebuffer,
364 GLenum attachment,
365 GLenum pname, GLint *params);
366
367 extern void GLAPIENTRY
368 _mesa_NamedFramebufferParameteri(GLuint framebuffer, GLenum pname,
369 GLint param);
370
371 extern void GLAPIENTRY
372 _mesa_NamedFramebufferParameteriEXT(GLuint framebuffer, GLenum pname,
373 GLint param);
374
375 extern void GLAPIENTRY
376 _mesa_GetNamedRenderbufferParameterivEXT(GLuint renderbuffer, GLenum pname,
377 GLint *params);
378
379 extern void GLAPIENTRY
380 _mesa_GetFramebufferParameterivEXT(GLuint framebuffer, GLenum pname,
381 GLint *param);
382
383 extern void GLAPIENTRY
384 _mesa_GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname,
385 GLint *param);
386
387 extern void GLAPIENTRY
388 _mesa_GetNamedFramebufferParameterivEXT(GLuint framebuffer, GLenum pname,
389 GLint *param);
390
391 void GLAPIENTRY
392 _mesa_InvalidateSubFramebuffer_no_error(GLenum target, GLsizei numAttachments,
393 const GLenum *attachments, GLint x,
394 GLint y, GLsizei width, GLsizei height);
395
396 extern void GLAPIENTRY
397 _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
398 const GLenum *attachments, GLint x, GLint y,
399 GLsizei width, GLsizei height);
400
401 extern void GLAPIENTRY
402 _mesa_InvalidateNamedFramebufferSubData(GLuint framebuffer,
403 GLsizei numAttachments,
404 const GLenum *attachments,
405 GLint x, GLint y,
406 GLsizei width, GLsizei height);
407 void GLAPIENTRY
408 _mesa_InvalidateFramebuffer_no_error(GLenum target, GLsizei numAttachments,
409 const GLenum *attachments);
410
411 extern void GLAPIENTRY
412 _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
413 const GLenum *attachments);
414
415 extern void GLAPIENTRY
416 _mesa_InvalidateNamedFramebufferData(GLuint framebuffer,
417 GLsizei numAttachments,
418 const GLenum *attachments);
419
420 extern void GLAPIENTRY
421 _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
422 const GLenum *attachments);
423
424 extern void GLAPIENTRY
425 _mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param);
426
427 extern void GLAPIENTRY
428 _mesa_FramebufferParameteriMESA(GLenum target, GLenum pname, GLint param);
429
430 extern void GLAPIENTRY
431 _mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
432
433 extern void GLAPIENTRY
434 _mesa_GetFramebufferParameterivMESA(GLenum target, GLenum pname, GLint *params);
435
436 extern void GLAPIENTRY
437 _mesa_FramebufferSampleLocationsfvARB(GLenum target, GLuint start,
438 GLsizei count, const GLfloat *v);
439
440 extern void GLAPIENTRY
441 _mesa_NamedFramebufferSampleLocationsfvARB(GLuint framebuffer, GLuint start,
442 GLsizei count, const GLfloat *v);
443
444 extern void GLAPIENTRY
445 _mesa_FramebufferSampleLocationsfvARB_no_error(GLenum target, GLuint start,
446 GLsizei count, const GLfloat *v);
447
448 extern void GLAPIENTRY
449 _mesa_NamedFramebufferSampleLocationsfvARB_no_error(GLuint framebuffer,
450 GLuint start, GLsizei count,
451 const GLfloat *v);
452
453 extern void GLAPIENTRY
454 _mesa_EvaluateDepthValuesARB(void);
455
456 #endif /* FBOBJECT_H */
457