mesa: Make core Mesa allocate the texture renderbuffer wrapper.
[mesa.git] / src / mesa / main / fbobject.h
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 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 #ifndef FBOBJECT_H
28 #define FBOBJECT_H
29
30 #include "compiler.h"
31 #include "glheader.h"
32
33 struct gl_context;
34 struct gl_texture_object;
35
36
37 /**
38 * Is the given FBO a user-created FBO?
39 */
40 static inline GLboolean
41 _mesa_is_user_fbo(const struct gl_framebuffer *fb)
42 {
43 return fb->Name != 0;
44 }
45
46
47 /**
48 * Is the given FBO a window system FBO (like an X window)?
49 */
50 static inline GLboolean
51 _mesa_is_winsys_fbo(const struct gl_framebuffer *fb)
52 {
53 return fb->Name == 0;
54 }
55
56
57
58 extern void
59 _mesa_init_fbobjects(struct gl_context *ctx);
60
61 extern struct gl_framebuffer *
62 _mesa_get_incomplete_framebuffer(void);
63
64 extern struct gl_renderbuffer *
65 _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
66
67 extern struct gl_framebuffer *
68 _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
69
70 extern struct gl_renderbuffer_attachment *
71 _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
72 GLenum attachment);
73
74
75 /** Return the texture image for a renderbuffer attachment */
76 static inline struct gl_texture_image *
77 _mesa_get_attachment_teximage(struct gl_renderbuffer_attachment *att)
78 {
79 assert(att->Type == GL_TEXTURE);
80 return att->Texture->Image[att->CubeMapFace][att->TextureLevel];
81 }
82
83
84 /** Return the (const) texture image for a renderbuffer attachment */
85 static inline const struct gl_texture_image *
86 _mesa_get_attachment_teximage_const(const struct gl_renderbuffer_attachment *att)
87 {
88 assert(att->Type == GL_TEXTURE);
89 return att->Texture->Image[att->CubeMapFace][att->TextureLevel];
90 }
91
92
93 extern void
94 _mesa_remove_attachment(struct gl_context *ctx,
95 struct gl_renderbuffer_attachment *att);
96
97 extern void
98 _mesa_set_texture_attachment(struct gl_context *ctx,
99 struct gl_framebuffer *fb,
100 struct gl_renderbuffer_attachment *att,
101 struct gl_texture_object *texObj,
102 GLenum texTarget, GLuint level, GLuint zoffset,
103 GLboolean layered);
104
105 extern void
106 _mesa_set_renderbuffer_attachment(struct gl_context *ctx,
107 struct gl_renderbuffer_attachment *att,
108 struct gl_renderbuffer *rb);
109
110 void
111 _mesa_update_texture_renderbuffer(struct gl_context *ctx,
112 struct gl_framebuffer *fb,
113 struct gl_renderbuffer_attachment *att);
114
115 extern void
116 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
117 struct gl_framebuffer *fb,
118 GLenum attachment, struct gl_renderbuffer *rb);
119
120 extern void
121 _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb);
122
123 extern GLboolean
124 _mesa_has_depthstencil_combined(const struct gl_framebuffer *fb);
125
126 extern void
127 _mesa_test_framebuffer_completeness(struct gl_context *ctx,
128 struct gl_framebuffer *fb);
129
130 extern GLboolean
131 _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
132
133 extern GLenum
134 _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
135
136 extern GLboolean GLAPIENTRY
137 _mesa_IsRenderbuffer(GLuint renderbuffer);
138
139 extern void GLAPIENTRY
140 _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer);
141
142 extern void GLAPIENTRY
143 _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
144
145 extern void GLAPIENTRY
146 _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers);
147
148 extern void GLAPIENTRY
149 _mesa_RenderbufferStorage(GLenum target, GLenum internalformat,
150 GLsizei width, GLsizei height);
151
152 extern void GLAPIENTRY
153 _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
154 GLenum internalformat,
155 GLsizei width, GLsizei height);
156
157 extern void GLAPIENTRY
158 _es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
159 GLsizei width, GLsizei height);
160
161 extern void GLAPIENTRY
162 _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
163
164 extern void GLAPIENTRY
165 _mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname,
166 GLint *params);
167
168 extern GLboolean GLAPIENTRY
169 _mesa_IsFramebuffer(GLuint framebuffer);
170
171 extern void GLAPIENTRY
172 _mesa_BindFramebuffer(GLenum target, GLuint framebuffer);
173
174 extern void GLAPIENTRY
175 _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
176
177 extern void GLAPIENTRY
178 _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers);
179
180 extern GLenum GLAPIENTRY
181 _mesa_CheckFramebufferStatus(GLenum target);
182
183 extern void GLAPIENTRY
184 _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
185 GLenum textarget, GLuint texture, GLint level);
186
187 extern void GLAPIENTRY
188 _mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
189 GLenum textarget, GLuint texture, GLint level);
190
191 extern void GLAPIENTRY
192 _mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
193 GLenum textarget, GLuint texture,
194 GLint level, GLint zoffset);
195
196 extern void GLAPIENTRY
197 _mesa_FramebufferTextureLayer(GLenum target, GLenum attachment,
198 GLuint texture, GLint level, GLint layer);
199
200 extern void GLAPIENTRY
201 _mesa_FramebufferTexture(GLenum target, GLenum attachment,
202 GLuint texture, GLint level);
203
204 extern void GLAPIENTRY
205 _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
206 GLenum renderbuffertarget,
207 GLuint renderbuffer);
208
209 extern void GLAPIENTRY
210 _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
211 GLenum pname, GLint *params);
212
213 extern void GLAPIENTRY
214 _mesa_GenerateMipmap(GLenum target);
215
216
217 extern void GLAPIENTRY
218 _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
219 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
220 GLbitfield mask, GLenum filter);
221
222 extern void GLAPIENTRY
223 _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
224 const GLenum *attachments, GLint x, GLint y,
225 GLsizei width, GLsizei height);
226
227 extern void GLAPIENTRY
228 _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
229 const GLenum *attachments);
230
231 extern void GLAPIENTRY
232 _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
233 const GLenum *attachments);
234
235 #endif /* FBOBJECT_H */