1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #ifndef FBOBJECT_H
27 #define FBOBJECT_H
28
29 #include "compiler.h"
30 #include "glheader.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_framebuffer *
67 _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
68
69 extern struct gl_renderbuffer_attachment *
70 _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
71 GLenum attachment);
72
73
74 /** Return the texture image for a renderbuffer attachment */
75 static inline struct gl_texture_image *
_mesa_get_attachment_teximage(struct gl_renderbuffer_attachment * att)76 _mesa_get_attachment_teximage(struct gl_renderbuffer_attachment *att)
77 {
78 assert(att->Type == GL_TEXTURE);
79 return att->Texture->Image[att->CubeMapFace][att->TextureLevel];
80 }
81
82
83 /** Return the (const) texture image for a renderbuffer attachment */
84 static inline const struct gl_texture_image *
_mesa_get_attachment_teximage_const(const struct gl_renderbuffer_attachment * att)85 _mesa_get_attachment_teximage_const(const struct gl_renderbuffer_attachment *att)
86 {
87 assert(att->Type == GL_TEXTURE);
88 return att->Texture->Image[att->CubeMapFace][att->TextureLevel];
89 }
90
91
92 extern void
93 _mesa_remove_attachment(struct gl_context *ctx,
94 struct gl_renderbuffer_attachment *att);
95
96 extern void
97 _mesa_set_texture_attachment(struct gl_context *ctx,
98 struct gl_framebuffer *fb,
99 struct gl_renderbuffer_attachment *att,
100 struct gl_texture_object *texObj,
101 GLenum texTarget, GLuint level, GLuint zoffset);
102
103 extern void
104 _mesa_set_renderbuffer_attachment(struct gl_context *ctx,
105 struct gl_renderbuffer_attachment *att,
106 struct gl_renderbuffer *rb);
107
108 extern void
109 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
110 struct gl_framebuffer *fb,
111 GLenum attachment, struct gl_renderbuffer *rb);
112
113 extern void
114 _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
115
116 extern void
117 _mesa_test_framebuffer_completeness(struct gl_context *ctx,
118 struct gl_framebuffer *fb);
119
120 extern GLboolean
121 _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
122
123 extern GLenum
124 _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
125
126 extern GLboolean GLAPIENTRY
127 _mesa_IsRenderbufferEXT(GLuint renderbuffer);
128
129 extern void GLAPIENTRY
130 _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer);
131
132 extern void GLAPIENTRY
133 _mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
134
135 extern void GLAPIENTRY
136 _mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
137
138 extern void GLAPIENTRY
139 _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalformat,
140 GLsizei width, GLsizei height);
141
142 extern void GLAPIENTRY
143 _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
144 GLenum internalformat,
145 GLsizei width, GLsizei height);
146
147 extern void GLAPIENTRY
148 _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
149 GLsizei width, GLsizei height);
150
151 extern void GLAPIENTRY
152 _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
153
154 extern void GLAPIENTRY
155 _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname,
156 GLint *params);
157
158 extern GLboolean GLAPIENTRY
159 _mesa_IsFramebufferEXT(GLuint framebuffer);
160
161 extern void GLAPIENTRY
162 _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer);
163
164 extern void GLAPIENTRY
165 _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
166
167 extern void GLAPIENTRY
168 _mesa_GenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
169
170 extern GLenum GLAPIENTRY
171 _mesa_CheckFramebufferStatusEXT(GLenum target);
172
173 extern void GLAPIENTRY
174 _mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
175 GLenum textarget, GLuint texture, GLint level);
176
177 extern void GLAPIENTRY
178 _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
179 GLenum textarget, GLuint texture, GLint level);
180
181 extern void GLAPIENTRY
182 _mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment,
183 GLenum textarget, GLuint texture,
184 GLint level, GLint zoffset);
185
186 extern void GLAPIENTRY
187 _mesa_FramebufferTextureLayerEXT(GLenum target, GLenum attachment,
188 GLuint texture, GLint level, GLint layer);
189
190 extern void GLAPIENTRY
191 _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
192 GLenum renderbuffertarget,
193 GLuint renderbuffer);
194
195 extern void GLAPIENTRY
196 _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
197 GLenum pname, GLint *params);
198
199 extern void GLAPIENTRY
200 _mesa_GenerateMipmapEXT(GLenum target);
201
202
203 extern void GLAPIENTRY
204 _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
205 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
206 GLbitfield mask, GLenum filter);
207
208 extern void GLAPIENTRY
209 _mesa_FramebufferTextureARB(GLenum target, GLenum attachment,
210 GLuint texture, GLint level);
211
212 extern void GLAPIENTRY
213 _mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment,
214 GLuint texture, GLint level, GLenum face);
215
216
217 extern void GLAPIENTRY
218 _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
219 const GLenum *attachments, GLint x, GLint y,
220 GLsizei width, GLsizei height);
221
222 extern void GLAPIENTRY
223 _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
224 const GLenum *attachments);
225
226 #endif /* FBOBJECT_H */
227