fbobject.h revision b8e80941
1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 23848b8605Smrg */ 24848b8605Smrg 25848b8605Smrg 26848b8605Smrg#ifndef FBOBJECT_H 27848b8605Smrg#define FBOBJECT_H 28848b8605Smrg 29848b8605Smrg#include "glheader.h" 30848b8605Smrg#include <stdbool.h> 31848b8605Smrg 32848b8605Smrgstruct gl_context; 33848b8605Smrgstruct gl_texture_object; 34848b8605Smrg 35848b8605Smrg 36848b8605Smrg/** 37848b8605Smrg * Is the given FBO a user-created FBO? 38848b8605Smrg */ 39848b8605Smrgstatic inline GLboolean 40848b8605Smrg_mesa_is_user_fbo(const struct gl_framebuffer *fb) 41848b8605Smrg{ 42848b8605Smrg return fb->Name != 0; 43848b8605Smrg} 44848b8605Smrg 45848b8605Smrg 46848b8605Smrg/** 47848b8605Smrg * Is the given FBO a window system FBO (like an X window)? 48848b8605Smrg */ 49848b8605Smrgstatic inline GLboolean 50848b8605Smrg_mesa_is_winsys_fbo(const struct gl_framebuffer *fb) 51848b8605Smrg{ 52848b8605Smrg return fb->Name == 0; 53848b8605Smrg} 54848b8605Smrg 55848b8605Smrg 56848b8605Smrg 57848b8605Smrgextern void 58848b8605Smrg_mesa_init_fbobjects(struct gl_context *ctx); 59848b8605Smrg 60848b8605Smrgextern struct gl_framebuffer * 61848b8605Smrg_mesa_get_incomplete_framebuffer(void); 62848b8605Smrg 63848b8605Smrgextern struct gl_renderbuffer * 64848b8605Smrg_mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id); 65848b8605Smrg 66b8e80941Smrgextern struct gl_renderbuffer * 67b8e80941Smrg_mesa_lookup_renderbuffer_err(struct gl_context *ctx, GLuint id, 68b8e80941Smrg const char *func); 69b8e80941Smrg 70848b8605Smrgextern struct gl_framebuffer * 71848b8605Smrg_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id); 72848b8605Smrg 73b8e80941Smrgextern struct gl_framebuffer * 74b8e80941Smrg_mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id, 75b8e80941Smrg const char *func); 76b8e80941Smrg 77848b8605Smrg 78848b8605Smrgvoid 79848b8605Smrg_mesa_update_texture_renderbuffer(struct gl_context *ctx, 80848b8605Smrg struct gl_framebuffer *fb, 81848b8605Smrg struct gl_renderbuffer_attachment *att); 82848b8605Smrg 83b8e80941Smrgextern void 84b8e80941Smrg_mesa_FramebufferRenderbuffer_sw(struct gl_context *ctx, 85b8e80941Smrg struct gl_framebuffer *fb, 86b8e80941Smrg GLenum attachment, 87b8e80941Smrg struct gl_renderbuffer *rb); 88b8e80941Smrg 89848b8605Smrgextern void 90848b8605Smrg_mesa_framebuffer_renderbuffer(struct gl_context *ctx, 91848b8605Smrg struct gl_framebuffer *fb, 92b8e80941Smrg GLenum attachment, 93b8e80941Smrg struct gl_renderbuffer *rb); 94b8e80941Smrg 95b8e80941Smrgextern void 96b8e80941Smrg_mesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, 97b8e80941Smrg GLenum internalFormat, GLsizei width, 98b8e80941Smrg GLsizei height, GLsizei samples, 99b8e80941Smrg GLsizei storageSamples); 100848b8605Smrg 101848b8605Smrgextern void 102848b8605Smrg_mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb); 103848b8605Smrg 104848b8605Smrgextern GLboolean 105848b8605Smrg_mesa_has_depthstencil_combined(const struct gl_framebuffer *fb); 106848b8605Smrg 107848b8605Smrgextern void 108848b8605Smrg_mesa_test_framebuffer_completeness(struct gl_context *ctx, 109848b8605Smrg struct gl_framebuffer *fb); 110848b8605Smrg 111848b8605Smrgextern GLboolean 112848b8605Smrg_mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat); 113848b8605Smrg 114848b8605Smrgextern GLenum 115b8e80941Smrg_mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat); 116848b8605Smrg 117848b8605Smrgextern bool 118848b8605Smrg_mesa_detach_renderbuffer(struct gl_context *ctx, 119848b8605Smrg struct gl_framebuffer *fb, 120848b8605Smrg const void *att); 121848b8605Smrg 122b8e80941Smrgextern struct gl_renderbuffer_attachment * 123b8e80941Smrg_mesa_get_and_validate_attachment(struct gl_context *ctx, 124b8e80941Smrg struct gl_framebuffer *fb, 125b8e80941Smrg GLenum attachment, const char *caller); 126b8e80941Smrg 127b8e80941Smrgextern void 128b8e80941Smrg_mesa_framebuffer_texture(struct gl_context *ctx, struct gl_framebuffer *fb, 129b8e80941Smrg GLenum attachment, 130b8e80941Smrg struct gl_renderbuffer_attachment *att, 131b8e80941Smrg struct gl_texture_object *texObj, GLenum textarget, 132b8e80941Smrg GLint level, GLsizei samples, 133b8e80941Smrg GLuint layer, GLboolean layered); 134b8e80941Smrg 135b8e80941Smrgextern GLenum 136b8e80941Smrg_mesa_check_framebuffer_status(struct gl_context *ctx, 137b8e80941Smrg struct gl_framebuffer *fb); 138b8e80941Smrg 139b8e80941Smrgextern void 140b8e80941Smrg_mesa_bind_framebuffers(struct gl_context *ctx, 141b8e80941Smrg struct gl_framebuffer *newDrawFb, 142b8e80941Smrg struct gl_framebuffer *newReadFb); 143b8e80941Smrg 144848b8605Smrgextern GLboolean GLAPIENTRY 145848b8605Smrg_mesa_IsRenderbuffer(GLuint renderbuffer); 146848b8605Smrg 147848b8605Smrgextern void GLAPIENTRY 148848b8605Smrg_mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer); 149848b8605Smrg 150848b8605Smrgextern void GLAPIENTRY 151848b8605Smrg_mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer); 152848b8605Smrg 153848b8605Smrgextern void GLAPIENTRY 154848b8605Smrg_mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers); 155848b8605Smrg 156b8e80941Smrgvoid GLAPIENTRY 157b8e80941Smrg_mesa_GenRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers); 158b8e80941Smrg 159848b8605Smrgextern void GLAPIENTRY 160848b8605Smrg_mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers); 161848b8605Smrg 162b8e80941Smrgvoid GLAPIENTRY 163b8e80941Smrg_mesa_CreateRenderbuffers_no_error(GLsizei n, GLuint *renderbuffers); 164b8e80941Smrg 165b8e80941Smrgextern void GLAPIENTRY 166b8e80941Smrg_mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers); 167b8e80941Smrg 168848b8605Smrgextern void GLAPIENTRY 169848b8605Smrg_mesa_RenderbufferStorage(GLenum target, GLenum internalformat, 170848b8605Smrg GLsizei width, GLsizei height); 171848b8605Smrg 172848b8605Smrgextern void GLAPIENTRY 173848b8605Smrg_mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples, 174848b8605Smrg GLenum internalformat, 175848b8605Smrg GLsizei width, GLsizei height); 176848b8605Smrg 177b8e80941Smrgextern void GLAPIENTRY 178b8e80941Smrg_mesa_RenderbufferStorageMultisampleAdvancedAMD( 179b8e80941Smrg GLenum target, GLsizei samples, GLsizei storageSamples, 180b8e80941Smrg GLenum internalFormat, GLsizei width, GLsizei height); 181b8e80941Smrg 182848b8605Smrgextern void GLAPIENTRY 183848b8605Smrg_es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, 184848b8605Smrg GLsizei width, GLsizei height); 185848b8605Smrg 186b8e80941Smrgextern void GLAPIENTRY 187b8e80941Smrg_mesa_NamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, 188b8e80941Smrg GLsizei width, GLsizei height); 189b8e80941Smrg 190b8e80941Smrgextern void GLAPIENTRY 191b8e80941Smrg_mesa_NamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, 192b8e80941Smrg GLenum internalformat, 193b8e80941Smrg GLsizei width, GLsizei height); 194b8e80941Smrg 195b8e80941Smrgextern void GLAPIENTRY 196b8e80941Smrg_mesa_NamedRenderbufferStorageMultisampleAdvancedAMD( 197b8e80941Smrg GLuint renderbuffer, GLsizei samples, GLsizei storageSamples, 198b8e80941Smrg GLenum internalformat, GLsizei width, GLsizei height); 199b8e80941Smrg 200848b8605Smrgextern void GLAPIENTRY 201848b8605Smrg_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image); 202848b8605Smrg 203848b8605Smrgextern void GLAPIENTRY 204848b8605Smrg_mesa_GetRenderbufferParameteriv(GLenum target, GLenum pname, 205848b8605Smrg GLint *params); 206848b8605Smrg 207b8e80941Smrgvoid GLAPIENTRY 208b8e80941Smrg_mesa_GetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, 209b8e80941Smrg GLint *params); 210b8e80941Smrg 211848b8605Smrgextern GLboolean GLAPIENTRY 212848b8605Smrg_mesa_IsFramebuffer(GLuint framebuffer); 213848b8605Smrg 214848b8605Smrgextern void GLAPIENTRY 215848b8605Smrg_mesa_BindFramebuffer(GLenum target, GLuint framebuffer); 216848b8605Smrg 217848b8605Smrgextern void GLAPIENTRY 218848b8605Smrg_mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer); 219848b8605Smrg 220848b8605Smrgextern void GLAPIENTRY 221848b8605Smrg_mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers); 222848b8605Smrg 223848b8605Smrgextern void GLAPIENTRY 224848b8605Smrg_mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers); 225848b8605Smrg 226b8e80941Smrgextern void GLAPIENTRY 227b8e80941Smrg_mesa_CreateFramebuffers(GLsizei n, GLuint *framebuffers); 228b8e80941Smrg 229b8e80941SmrgGLenum GLAPIENTRY 230b8e80941Smrg_mesa_CheckFramebufferStatus_no_error(GLenum target); 231b8e80941Smrg 232848b8605Smrgextern GLenum GLAPIENTRY 233848b8605Smrg_mesa_CheckFramebufferStatus(GLenum target); 234848b8605Smrg 235b8e80941Smrgextern GLenum GLAPIENTRY 236b8e80941Smrg_mesa_CheckNamedFramebufferStatus(GLuint framebuffer, GLenum target); 237b8e80941Smrg 238b8e80941Smrgextern void GLAPIENTRY 239b8e80941Smrg_mesa_FramebufferTexture1D_no_error(GLenum target, GLenum attachment, 240b8e80941Smrg GLenum textarget, GLuint texture, 241b8e80941Smrg GLint level); 242848b8605Smrgextern void GLAPIENTRY 243848b8605Smrg_mesa_FramebufferTexture1D(GLenum target, GLenum attachment, 244848b8605Smrg GLenum textarget, GLuint texture, GLint level); 245848b8605Smrg 246848b8605Smrgextern void GLAPIENTRY 247b8e80941Smrg_mesa_FramebufferTexture2D_no_error(GLenum target, GLenum attachment, 248b8e80941Smrg GLenum textarget, GLuint texture, 249b8e80941Smrg GLint level); 250b8e80941Smrgextern void GLAPIENTRY 251848b8605Smrg_mesa_FramebufferTexture2D(GLenum target, GLenum attachment, 252848b8605Smrg GLenum textarget, GLuint texture, GLint level); 253848b8605Smrg 254b8e80941Smrgvoid GLAPIENTRY 255b8e80941Smrg_mesa_FramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, 256b8e80941Smrg GLenum textarget, GLuint texture, 257b8e80941Smrg GLint level, GLsizei samples); 258b8e80941Smrg 259b8e80941Smrgextern void GLAPIENTRY 260b8e80941Smrg_mesa_FramebufferTexture3D_no_error(GLenum target, GLenum attachment, 261b8e80941Smrg GLenum textarget, GLuint texture, 262b8e80941Smrg GLint level, GLint layer); 263848b8605Smrgextern void GLAPIENTRY 264848b8605Smrg_mesa_FramebufferTexture3D(GLenum target, GLenum attachment, 265848b8605Smrg GLenum textarget, GLuint texture, 266b8e80941Smrg GLint level, GLint layer); 267848b8605Smrg 268848b8605Smrgextern void GLAPIENTRY 269b8e80941Smrg_mesa_FramebufferTextureLayer_no_error(GLenum target, GLenum attachment, 270b8e80941Smrg GLuint texture, GLint level, 271b8e80941Smrg GLint layer); 272b8e80941Smrgextern void GLAPIENTRY 273848b8605Smrg_mesa_FramebufferTextureLayer(GLenum target, GLenum attachment, 274848b8605Smrg GLuint texture, GLint level, GLint layer); 275848b8605Smrg 276848b8605Smrgextern void GLAPIENTRY 277b8e80941Smrg_mesa_NamedFramebufferTextureLayer_no_error(GLuint framebuffer, 278b8e80941Smrg GLenum attachment, 279b8e80941Smrg GLuint texture, GLint level, 280b8e80941Smrg GLint layer); 281b8e80941Smrgextern void GLAPIENTRY 282b8e80941Smrg_mesa_NamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, 283b8e80941Smrg GLuint texture, GLint level, GLint layer); 284b8e80941Smrg 285b8e80941Smrgextern void GLAPIENTRY 286b8e80941Smrg_mesa_FramebufferTexture_no_error(GLenum target, GLenum attachment, 287b8e80941Smrg GLuint texture, GLint level); 288b8e80941Smrgextern void GLAPIENTRY 289848b8605Smrg_mesa_FramebufferTexture(GLenum target, GLenum attachment, 290848b8605Smrg GLuint texture, GLint level); 291848b8605Smrg 292b8e80941Smrgextern void GLAPIENTRY 293b8e80941Smrg_mesa_NamedFramebufferTexture_no_error(GLuint framebuffer, GLenum attachment, 294b8e80941Smrg GLuint texture, GLint level); 295b8e80941Smrgextern void GLAPIENTRY 296b8e80941Smrg_mesa_NamedFramebufferTexture(GLuint framebuffer, GLenum attachment, 297b8e80941Smrg GLuint texture, GLint level); 298b8e80941Smrg 299b8e80941Smrgvoid GLAPIENTRY 300b8e80941Smrg_mesa_FramebufferRenderbuffer_no_error(GLenum target, GLenum attachment, 301b8e80941Smrg GLenum renderbuffertarget, 302b8e80941Smrg GLuint renderbuffer); 303b8e80941Smrg 304848b8605Smrgextern void GLAPIENTRY 305848b8605Smrg_mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, 306848b8605Smrg GLenum renderbuffertarget, 307848b8605Smrg GLuint renderbuffer); 308848b8605Smrg 309b8e80941Smrgvoid GLAPIENTRY 310b8e80941Smrg_mesa_NamedFramebufferRenderbuffer_no_error(GLuint framebuffer, 311b8e80941Smrg GLenum attachment, 312b8e80941Smrg GLenum renderbuffertarget, 313b8e80941Smrg GLuint renderbuffer); 314b8e80941Smrg 315b8e80941Smrgextern void GLAPIENTRY 316b8e80941Smrg_mesa_NamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, 317b8e80941Smrg GLenum renderbuffertarget, 318b8e80941Smrg GLuint renderbuffer); 319b8e80941Smrg 320848b8605Smrgextern void GLAPIENTRY 321848b8605Smrg_mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, 322848b8605Smrg GLenum pname, GLint *params); 323b8e80941Smrgextern void GLAPIENTRY 324b8e80941Smrg_mesa_GetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, 325b8e80941Smrg GLenum attachment, 326b8e80941Smrg GLenum pname, GLint *params); 327b8e80941Smrg 328b8e80941Smrgextern void GLAPIENTRY 329b8e80941Smrg_mesa_NamedFramebufferParameteri(GLuint framebuffer, GLenum pname, 330b8e80941Smrg GLint param); 331b8e80941Smrg 332b8e80941Smrgextern void GLAPIENTRY 333b8e80941Smrg_mesa_GetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, 334b8e80941Smrg GLint *param); 335b8e80941Smrg 336b8e80941Smrgvoid GLAPIENTRY 337b8e80941Smrg_mesa_InvalidateSubFramebuffer_no_error(GLenum target, GLsizei numAttachments, 338b8e80941Smrg const GLenum *attachments, GLint x, 339b8e80941Smrg GLint y, GLsizei width, GLsizei height); 340848b8605Smrg 341848b8605Smrgextern void GLAPIENTRY 342848b8605Smrg_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, 343848b8605Smrg const GLenum *attachments, GLint x, GLint y, 344848b8605Smrg GLsizei width, GLsizei height); 345848b8605Smrg 346b8e80941Smrgextern void GLAPIENTRY 347b8e80941Smrg_mesa_InvalidateNamedFramebufferSubData(GLuint framebuffer, 348b8e80941Smrg GLsizei numAttachments, 349b8e80941Smrg const GLenum *attachments, 350b8e80941Smrg GLint x, GLint y, 351b8e80941Smrg GLsizei width, GLsizei height); 352b8e80941Smrgvoid GLAPIENTRY 353b8e80941Smrg_mesa_InvalidateFramebuffer_no_error(GLenum target, GLsizei numAttachments, 354b8e80941Smrg const GLenum *attachments); 355b8e80941Smrg 356848b8605Smrgextern void GLAPIENTRY 357848b8605Smrg_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments, 358848b8605Smrg const GLenum *attachments); 359848b8605Smrg 360b8e80941Smrgextern void GLAPIENTRY 361b8e80941Smrg_mesa_InvalidateNamedFramebufferData(GLuint framebuffer, 362b8e80941Smrg GLsizei numAttachments, 363b8e80941Smrg const GLenum *attachments); 364b8e80941Smrg 365848b8605Smrgextern void GLAPIENTRY 366848b8605Smrg_mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, 367848b8605Smrg const GLenum *attachments); 368848b8605Smrg 369b8e80941Smrgextern void GLAPIENTRY 370b8e80941Smrg_mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param); 371b8e80941Smrg 372b8e80941Smrgextern void GLAPIENTRY 373b8e80941Smrg_mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params); 374b8e80941Smrg 375b8e80941Smrgextern void GLAPIENTRY 376b8e80941Smrg_mesa_FramebufferSampleLocationsfvARB(GLenum target, GLuint start, 377b8e80941Smrg GLsizei count, const GLfloat *v); 378b8e80941Smrg 379b8e80941Smrgextern void GLAPIENTRY 380b8e80941Smrg_mesa_NamedFramebufferSampleLocationsfvARB(GLuint framebuffer, GLuint start, 381b8e80941Smrg GLsizei count, const GLfloat *v); 382b8e80941Smrg 383b8e80941Smrgextern void GLAPIENTRY 384b8e80941Smrg_mesa_FramebufferSampleLocationsfvARB_no_error(GLenum target, GLuint start, 385b8e80941Smrg GLsizei count, const GLfloat *v); 386b8e80941Smrg 387b8e80941Smrgextern void GLAPIENTRY 388b8e80941Smrg_mesa_NamedFramebufferSampleLocationsfvARB_no_error(GLuint framebuffer, 389b8e80941Smrg GLuint start, GLsizei count, 390b8e80941Smrg const GLfloat *v); 391b8e80941Smrg 392b8e80941Smrgextern void GLAPIENTRY 393b8e80941Smrg_mesa_EvaluateDepthValuesARB(void); 394b8e80941Smrg 395848b8605Smrg#endif /* FBOBJECT_H */ 396