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
32struct gl_context;
33struct gl_texture_object;
34
35
36/**
37 * Is the given FBO a user-created FBO?
38 */
39static inline GLboolean
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 */
49static inline GLboolean
50_mesa_is_winsys_fbo(const struct gl_framebuffer *fb)
51{
52   return fb->Name == 0;
53}
54
55
56
57extern void
58_mesa_init_fbobjects(struct gl_context *ctx);
59
60extern struct gl_framebuffer *
61_mesa_get_incomplete_framebuffer(void);
62
63extern struct gl_renderbuffer *
64_mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
65
66extern struct gl_framebuffer *
67_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
68
69extern 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 */
75static inline struct gl_texture_image *
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 */
84static inline const struct gl_texture_image *
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
92extern void
93_mesa_remove_attachment(struct gl_context *ctx,
94                        struct gl_renderbuffer_attachment *att);
95
96extern 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
103extern void
104_mesa_set_renderbuffer_attachment(struct gl_context *ctx,
105                                  struct gl_renderbuffer_attachment *att,
106                                  struct gl_renderbuffer *rb);
107
108extern void
109_mesa_framebuffer_renderbuffer(struct gl_context *ctx,
110                               struct gl_framebuffer *fb,
111                               GLenum attachment, struct gl_renderbuffer *rb);
112
113extern void
114_mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
115
116extern void
117_mesa_test_framebuffer_completeness(struct gl_context *ctx,
118                                    struct gl_framebuffer *fb);
119
120extern GLboolean
121_mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
122
123extern GLenum
124_mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
125
126extern GLboolean GLAPIENTRY
127_mesa_IsRenderbufferEXT(GLuint renderbuffer);
128
129extern void GLAPIENTRY
130_mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer);
131
132extern void GLAPIENTRY
133_mesa_DeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
134
135extern void GLAPIENTRY
136_mesa_GenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
137
138extern void GLAPIENTRY
139_mesa_RenderbufferStorageEXT(GLenum target, GLenum internalformat,
140                             GLsizei width, GLsizei height);
141
142extern void GLAPIENTRY
143_mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
144                                     GLenum internalformat,
145                                     GLsizei width, GLsizei height);
146
147extern void GLAPIENTRY
148_es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
149			   GLsizei width, GLsizei height);
150
151extern void GLAPIENTRY
152_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
153
154extern void GLAPIENTRY
155_mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname,
156                                    GLint *params);
157
158extern GLboolean GLAPIENTRY
159_mesa_IsFramebufferEXT(GLuint framebuffer);
160
161extern void GLAPIENTRY
162_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer);
163
164extern void GLAPIENTRY
165_mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
166
167extern void GLAPIENTRY
168_mesa_GenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
169
170extern GLenum GLAPIENTRY
171_mesa_CheckFramebufferStatusEXT(GLenum target);
172
173extern void GLAPIENTRY
174_mesa_FramebufferTexture1DEXT(GLenum target, GLenum attachment,
175                              GLenum textarget, GLuint texture, GLint level);
176
177extern void GLAPIENTRY
178_mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
179                              GLenum textarget, GLuint texture, GLint level);
180
181extern void GLAPIENTRY
182_mesa_FramebufferTexture3DEXT(GLenum target, GLenum attachment,
183                              GLenum textarget, GLuint texture,
184                              GLint level, GLint zoffset);
185
186extern void GLAPIENTRY
187_mesa_FramebufferTextureLayerEXT(GLenum target, GLenum attachment,
188                                 GLuint texture, GLint level, GLint layer);
189
190extern void GLAPIENTRY
191_mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
192                                 GLenum renderbuffertarget,
193                                 GLuint renderbuffer);
194
195extern void GLAPIENTRY
196_mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
197                                             GLenum pname, GLint *params);
198
199extern void GLAPIENTRY
200_mesa_GenerateMipmapEXT(GLenum target);
201
202
203extern 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
208extern void GLAPIENTRY
209_mesa_FramebufferTextureARB(GLenum target, GLenum attachment,
210                            GLuint texture, GLint level);
211
212extern void GLAPIENTRY
213_mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment,
214                                GLuint texture, GLint level, GLenum face);
215
216
217extern void GLAPIENTRY
218_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
219                               const GLenum *attachments, GLint x, GLint y,
220                               GLsizei width, GLsizei height);
221
222extern void GLAPIENTRY
223_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
224                            const GLenum *attachments);
225
226#endif /* FBOBJECT_H */
227