framebuffer.h revision 01e04c3f
17117f1b4Smrg/* 27117f1b4Smrg * Mesa 3-D graphics library 37117f1b4Smrg * 47117f1b4Smrg * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 57117f1b4Smrg * 67117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a 77117f1b4Smrg * copy of this software and associated documentation files (the "Software"), 87117f1b4Smrg * to deal in the Software without restriction, including without limitation 97117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 107117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the 117117f1b4Smrg * Software is furnished to do so, subject to the following conditions: 127117f1b4Smrg * 137117f1b4Smrg * The above copyright notice and this permission notice shall be included 147117f1b4Smrg * in all copies or substantial portions of the Software. 157117f1b4Smrg * 167117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 177117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 187117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE. 237117f1b4Smrg */ 247117f1b4Smrg 257117f1b4Smrg 267117f1b4Smrg#ifndef FRAMEBUFFER_H 277117f1b4Smrg#define FRAMEBUFFER_H 287117f1b4Smrg 2901e04c3fSmrg#include "mtypes.h" 303464ebd5Sriastradh 313464ebd5Sriastradhstruct gl_config; 323464ebd5Sriastradhstruct gl_context; 33af69d88dSmrgstruct gl_renderbuffer; 347117f1b4Smrg 357117f1b4Smrgextern struct gl_framebuffer * 363464ebd5Sriastradh_mesa_create_framebuffer(const struct gl_config *visual); 377117f1b4Smrg 387117f1b4Smrgextern struct gl_framebuffer * 393464ebd5Sriastradh_mesa_new_framebuffer(struct gl_context *ctx, GLuint name); 407117f1b4Smrg 417117f1b4Smrgextern void 42cdc920a0Smrg_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, 433464ebd5Sriastradh const struct gl_config *visual); 44cdc920a0Smrg 45cdc920a0Smrgextern void 46cdc920a0Smrg_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name); 477117f1b4Smrg 487117f1b4Smrgextern void 497117f1b4Smrg_mesa_destroy_framebuffer(struct gl_framebuffer *buffer); 507117f1b4Smrg 517117f1b4Smrgextern void 527117f1b4Smrg_mesa_free_framebuffer_data(struct gl_framebuffer *buffer); 537117f1b4Smrg 547117f1b4Smrgextern void 55af69d88dSmrg_mesa_reference_framebuffer_(struct gl_framebuffer **ptr, 56af69d88dSmrg struct gl_framebuffer *fb); 57af69d88dSmrg 58af69d88dSmrgstatic inline void 597117f1b4Smrg_mesa_reference_framebuffer(struct gl_framebuffer **ptr, 60af69d88dSmrg struct gl_framebuffer *fb) 61af69d88dSmrg{ 62af69d88dSmrg if (*ptr != fb) 63af69d88dSmrg _mesa_reference_framebuffer_(ptr, fb); 64af69d88dSmrg} 657117f1b4Smrg 667117f1b4Smrgextern void 673464ebd5Sriastradh_mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, 687117f1b4Smrg GLuint width, GLuint height); 697117f1b4Smrg 70c1f859d4Smrg 71c1f859d4Smrgextern void 723464ebd5Sriastradh_mesa_resizebuffers( struct gl_context *ctx ); 73c1f859d4Smrg 74af69d88dSmrgextern void 7501e04c3fSmrg_mesa_intersect_scissor_bounding_box(const struct gl_context *ctx, 7601e04c3fSmrg unsigned idx, int *bbox); 7701e04c3fSmrg 7801e04c3fSmrgstatic inline GLuint 7901e04c3fSmrg_mesa_geometric_width(const struct gl_framebuffer *buffer) 8001e04c3fSmrg{ 8101e04c3fSmrg return buffer->_HasAttachments ? 8201e04c3fSmrg buffer->Width : buffer->DefaultGeometry.Width; 8301e04c3fSmrg} 8401e04c3fSmrg 8501e04c3fSmrgstatic inline GLuint 8601e04c3fSmrg_mesa_geometric_height(const struct gl_framebuffer *buffer) 8701e04c3fSmrg{ 8801e04c3fSmrg return buffer->_HasAttachments ? 8901e04c3fSmrg buffer->Height : buffer->DefaultGeometry.Height; 9001e04c3fSmrg} 9101e04c3fSmrg 9201e04c3fSmrgstatic inline GLuint 9301e04c3fSmrg_mesa_geometric_samples(const struct gl_framebuffer *buffer) 9401e04c3fSmrg{ 9501e04c3fSmrg return buffer->_HasAttachments ? 9601e04c3fSmrg buffer->Visual.samples : 9701e04c3fSmrg buffer->DefaultGeometry._NumSamples; 9801e04c3fSmrg} 9901e04c3fSmrg 10001e04c3fSmrgstatic inline GLuint 10101e04c3fSmrg_mesa_geometric_layers(const struct gl_framebuffer *buffer) 10201e04c3fSmrg{ 10301e04c3fSmrg return buffer->_HasAttachments ? 10401e04c3fSmrg buffer->MaxNumLayers : buffer->DefaultGeometry.Layers; 10501e04c3fSmrg} 106c1f859d4Smrg 1077117f1b4Smrgextern void 10801e04c3fSmrg_mesa_update_draw_buffer_bounds(struct gl_context *ctx, 10901e04c3fSmrg struct gl_framebuffer *drawFb); 1107117f1b4Smrg 1117117f1b4Smrgextern void 1123464ebd5Sriastradh_mesa_update_framebuffer_visual(struct gl_context *ctx, 1133464ebd5Sriastradh struct gl_framebuffer *fb); 1147117f1b4Smrg 1157117f1b4Smrgextern void 11601e04c3fSmrg_mesa_update_framebuffer(struct gl_context *ctx, 11701e04c3fSmrg struct gl_framebuffer *readFb, 11801e04c3fSmrg struct gl_framebuffer *drawFb); 1197117f1b4Smrg 1207117f1b4Smrgextern GLboolean 1213464ebd5Sriastradh_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format); 1227117f1b4Smrg 1237117f1b4Smrgextern GLboolean 1243464ebd5Sriastradh_mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format); 1257117f1b4Smrg 1264a49301eSmrgextern GLenum 12701e04c3fSmrg_mesa_get_color_read_type(struct gl_context *ctx, 12801e04c3fSmrg struct gl_framebuffer *fb, 12901e04c3fSmrg const char *caller); 1304a49301eSmrg 1314a49301eSmrgextern GLenum 13201e04c3fSmrg_mesa_get_color_read_format(struct gl_context *ctx, 13301e04c3fSmrg struct gl_framebuffer *fb, 13401e04c3fSmrg const char *caller); 1353464ebd5Sriastradh 136af69d88dSmrgextern struct gl_renderbuffer * 137af69d88dSmrg_mesa_get_read_renderbuffer_for_format(const struct gl_context *ctx, 138af69d88dSmrg GLenum format); 139af69d88dSmrg 1403464ebd5Sriastradhextern void 1413464ebd5Sriastradh_mesa_print_framebuffer(const struct gl_framebuffer *fb); 1427117f1b4Smrg 14301e04c3fSmrgextern bool 14401e04c3fSmrg_mesa_is_front_buffer_reading(const struct gl_framebuffer *fb); 14501e04c3fSmrg 14601e04c3fSmrgextern bool 14701e04c3fSmrg_mesa_is_front_buffer_drawing(const struct gl_framebuffer *fb); 14801e04c3fSmrg 14901e04c3fSmrgextern bool 15001e04c3fSmrg_mesa_is_multisample_enabled(const struct gl_context *ctx); 15101e04c3fSmrg 15201e04c3fSmrgextern bool 15301e04c3fSmrg_mesa_is_alpha_test_enabled(const struct gl_context *ctx); 15401e04c3fSmrg 15501e04c3fSmrgextern bool 15601e04c3fSmrg_mesa_is_alpha_to_coverage_enabled(const struct gl_context *ctx); 15701e04c3fSmrg 1587117f1b4Smrg#endif /* FRAMEBUFFER_H */ 159