xref: /third_party/mesa3d/src/mesa/main/fbobject.h (revision bf215546)
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
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 struct gl_framebuffer *
58_mesa_get_incomplete_framebuffer(void);
59
60extern struct gl_renderbuffer *
61_mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
62
63extern struct gl_renderbuffer *
64_mesa_lookup_renderbuffer_err(struct gl_context *ctx, GLuint id,
65                              const char *func);
66
67extern struct gl_framebuffer *
68_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
69
70extern struct gl_framebuffer *
71_mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id,
72                             const char *func);
73
74struct gl_framebuffer *
75_mesa_lookup_framebuffer_dsa(struct gl_context *ctx, GLuint id,
76                             const char* func);
77
78
79void
80_mesa_update_texture_renderbuffer(struct gl_context *ctx,
81                                  struct gl_framebuffer *fb,
82                                  struct gl_renderbuffer_attachment *att);
83
84extern void
85_mesa_framebuffer_renderbuffer(struct gl_context *ctx,
86                               struct gl_framebuffer *fb,
87                               GLenum attachment,
88                               struct gl_renderbuffer *rb);
89
90extern 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
96extern GLboolean
97_mesa_has_depthstencil_combined(const struct gl_framebuffer *fb);
98
99extern void
100_mesa_test_framebuffer_completeness(struct gl_context *ctx,
101                                    struct gl_framebuffer *fb);
102
103extern GLboolean
104_mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat);
105
106extern GLenum
107_mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat);
108
109extern bool
110_mesa_detach_renderbuffer(struct gl_context *ctx,
111                          struct gl_framebuffer *fb,
112                          const void *att);
113
114extern 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
119extern 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
127extern GLenum
128_mesa_check_framebuffer_status(struct gl_context *ctx,
129                               struct gl_framebuffer *fb);
130
131extern 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