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 struct gl_framebuffer *
58 _mesa_get_incomplete_framebuffer(void);
59
60 extern struct gl_renderbuffer *
61 _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
62
63 extern struct gl_renderbuffer *
64 _mesa_lookup_renderbuffer_err(struct gl_context *ctx, GLuint id,
65 const char *func);
66
67 extern struct gl_framebuffer *
68 _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
69
70 extern struct gl_framebuffer *
71 _mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id,
72 const char *func);
73
74 struct gl_framebuffer *
75 _mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id,
76 const char* func);
77
78
79 void
80 _mesa_update_texture_renderbuffer(struct gl_context *ctx,
81 struct gl_framebuffer *fb,
82 struct gl_renderbuffer_attachment *att);
83
84 extern void
85 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
86 struct gl_framebuffer *fb,
87 GLenum attachment,
88 struct gl_renderbuffer *rb);
89
90 extern void
91 _mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
92 GLenum internalFormat, GLsizei width,
93 GLsizei height, GLsizei samples,
94 GLsizei storageSamples);
95
96 extern GLboolean
97 _mesa_has_depthstencil_combined(const struct gl_framebuffer *fb);
98
99 extern void
100 _mesa_test_framebuffer_completeness(struct gl_context *ctx,
101 struct gl_framebuffer *fb);
102
103 extern GLboolean
104 _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
105
106 extern GLenum
107 _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat);
108
109 extern bool
110 _mesa_detach_renderbuffer(struct gl_context *ctx,
111 struct gl_framebuffer *fb,
112 const void *att);
113
114 extern struct gl_renderbuffer_attachment *
115 _mesa_get_and_validate_attachment(struct gl_context *ctx,
116 struct gl_framebuffer *fb,
117 GLenum attachment, const char *caller);
118
119 extern void
120 _mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
121 GLenum attachment,
122 struct gl_renderbuffer_attachment *att,
123 struct gl_texture_object *texObj, GLenum textarget,
124 GLint level, GLsizei samples,
125 GLuint layer, GLboolean layered);
126
127 extern GLenum
128 _mesa_check_framebuffer_status(struct gl_context *ctx,
129 struct gl_framebuffer *fb);
130
131 extern void
132 _mesa_bind_framebuffers(struct gl_context *ctx,
133 struct gl_framebuffer *newDrawFb,
134 struct gl_framebuffer *newReadFb);
135
136 #endif /* FBOBJECT_H */
137