#include "glheader.h"
#include "buffers.h"
#include "colormac.h"
#include "context.h"
#include "enums.h"
#include "fbobject.h"
#include "state.h"
Defines | |
#define | BAD_MASK ~0u |
Functions | |
static GLbitfield | supported_buffer_bitmask (const GLcontext *ctx, const struct gl_framebuffer *fb) |
Return bitmask of BUFFER_BIT_* flags indicating which color buffers are available to the rendering context (for drawing or reading). | |
static GLbitfield | draw_buffer_enum_to_bitmask (GLenum buffer) |
Helper routine used by glDrawBuffer and glDrawBuffersARB. | |
static GLint | read_buffer_enum_to_index (GLenum buffer) |
Helper routine used by glReadBuffer. | |
void GLAPIENTRY | _mesa_DrawBuffer (GLenum buffer) |
Called by glDrawBuffer(). | |
void GLAPIENTRY | _mesa_DrawBuffersARB (GLsizei n, const GLenum *buffers) |
Called by glDrawBuffersARB; specifies the destination color renderbuffers for N fragment program color outputs. | |
void | _mesa_drawbuffers (GLcontext *ctx, GLuint n, const GLenum *buffers, const GLbitfield *destMask) |
Helper function to set the GL_DRAW_BUFFER state in the context and current FBO. | |
void | _mesa_readbuffer (GLcontext *ctx, GLenum buffer, GLint bufferIndex) |
Like. | |
void GLAPIENTRY | _mesa_ReadBuffer (GLenum buffer) |
Called by glReadBuffer to set the source renderbuffer for reading pixels. |
#define BAD_MASK ~0u |
void GLAPIENTRY _mesa_DrawBuffer | ( | GLenum | buffer | ) |
Called by glDrawBuffer().
Specify which renderbuffer(s) to draw into for the first color output. <buffer> can name zero, one, two or four renderbuffers!
buffer | buffer token such as GL_LEFT or GL_FRONT_AND_BACK, etc. |
Furthermore, upon a MakeCurrent() or BindFramebuffer() call, if the new FB is a window system FB, we need to re-update the FB's ColorDrawBuffer state to match the context. This is handled in _mesa_update_framebuffer().
See the GL_EXT_framebuffer_object spec for more info.
void _mesa_drawbuffers | ( | GLcontext * | ctx, | |
GLuint | n, | |||
const GLenum * | buffers, | |||
const GLbitfield * | destMask | |||
) |
Helper function to set the GL_DRAW_BUFFER state in the context and current FBO.
All error checking will have been done prior to calling this function so nothing should go wrong at this point.
ctx | current context | |
n | number of color outputs to set | |
buffers | array[n] of colorbuffer names, like GL_LEFT. | |
destMask | array[n] of BUFFER_BIT_* bitmasks which correspond to the colorbuffer names. (i.e. GL_FRONT_AND_BACK => BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT). |
void GLAPIENTRY _mesa_DrawBuffersARB | ( | GLsizei | n, | |
const GLenum * | buffers | |||
) |
Called by glDrawBuffersARB; specifies the destination color renderbuffers for N fragment program color outputs.
n | number of outputs | |
buffers | array [n] of renderbuffer names. Unlike glDrawBuffer, the names cannot specify more than one buffer. For example, GL_FRONT_AND_BACK is illegal. |
void GLAPIENTRY _mesa_ReadBuffer | ( | GLenum | buffer | ) |
Called by glReadBuffer to set the source renderbuffer for reading pixels.
mode | color buffer such as GL_FRONT, GL_BACK, etc. |
void _mesa_readbuffer | ( | GLcontext * | ctx, | |
GLenum | buffer, | |||
GLint | bufferIndex | |||
) |
Like.
ctx | the rendering context | |
buffer | GL_FRONT, GL_BACK, GL_COLOR_ATTACHMENT0, etc. | |
bufferIndex | the numerical index corresponding to 'buffer' |
static GLbitfield draw_buffer_enum_to_bitmask | ( | GLenum | buffer | ) | [static] |
Helper routine used by glDrawBuffer and glDrawBuffersARB.
Given a GLenum naming one or more color buffers (such as GL_FRONT_AND_BACK), return the corresponding bitmask of BUFFER_BIT_* flags.
static GLint read_buffer_enum_to_index | ( | GLenum | buffer | ) | [static] |
Helper routine used by glReadBuffer.
Given a GLenum naming a color buffer, return the index of the corresponding renderbuffer (a BUFFER_* value). return -1 for an invalid buffer.
static GLbitfield supported_buffer_bitmask | ( | const GLcontext * | ctx, | |
const struct gl_framebuffer * | fb | |||
) | [static] |
Return bitmask of BUFFER_BIT_* flags indicating which color buffers are available to the rendering context (for drawing or reading).
This depends on the type of framebuffer. For window system framebuffers we look at the framebuffer's visual. But for user-create framebuffers we look at the number of supported color attachments.
fb | the framebuffer to draw to, or read from |