/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
if (fb) {
fb->Name = name;
fb->RefCount = 1;
- fb->Delete = _mesa_destroy_framebuffer;
fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT;
fb->_ColorDrawBufferMask[0] = BUFFER_BIT_COLOR0;
fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
/**
- * Initialize a gl_framebuffer object.
+ * Initialize a gl_framebuffer object. Typically used to initialize
+ * window system-created framebuffers, not user-created framebuffers.
* \sa _mesa_create_framebuffer
*/
void
}
-/**
- * Create/attach software-based renderbuffers to the given framebuffer.
- * This is a helper routine for device drivers. Drivers can just as well
- * call the individual _mesa_add_*_renderbuffer() routines directly.
- */
-void
-_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
- GLboolean color,
- GLboolean depth,
- GLboolean stencil,
- GLboolean accum,
- GLboolean alpha,
- GLboolean aux)
-{
- GLboolean frontLeft = GL_TRUE;
- GLboolean backLeft = fb->Visual.doubleBufferMode;
- GLboolean frontRight = fb->Visual.stereoMode;
- GLboolean backRight = fb->Visual.stereoMode && fb->Visual.doubleBufferMode;
-
- if (color) {
- if (fb->Visual.rgbMode) {
- assert(fb->Visual.redBits == fb->Visual.greenBits);
- assert(fb->Visual.redBits == fb->Visual.blueBits);
- _mesa_add_color_renderbuffers(NULL, fb,
- fb->Visual.redBits,
- fb->Visual.alphaBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
- else {
- _mesa_add_color_index_renderbuffers(NULL, fb,
- fb->Visual.indexBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
- }
-
- if (depth) {
- assert(fb->Visual.depthBits > 0);
- _mesa_add_depth_renderbuffer(NULL, fb, fb->Visual.depthBits);
- }
-
- if (stencil) {
- assert(fb->Visual.stencilBits > 0);
- _mesa_add_stencil_renderbuffer(NULL, fb, fb->Visual.stencilBits);
- }
-
- if (accum) {
- assert(fb->Visual.rgbMode);
- assert(fb->Visual.accumRedBits > 0);
- assert(fb->Visual.accumGreenBits > 0);
- assert(fb->Visual.accumBlueBits > 0);
- _mesa_add_accum_renderbuffer(NULL, fb,
- fb->Visual.accumRedBits,
- fb->Visual.accumGreenBits,
- fb->Visual.accumBlueBits,
- fb->Visual.accumAlphaBits);
- }
-
- if (aux) {
- assert(fb->Visual.rgbMode);
- assert(fb->Visual.numAuxBuffers > 0);
- _mesa_add_aux_renderbuffers(NULL, fb, fb->Visual.redBits,
- fb->Visual.numAuxBuffers);
- }
-
-#if 1
- if (alpha) {
- assert(fb->Visual.rgbMode);
- assert(fb->Visual.alphaBits > 0);
- _mesa_add_alpha_renderbuffers(NULL, fb, fb->Visual.alphaBits,
- frontLeft, backLeft,
- frontRight, backRight);
- }
-#endif
-
-#if 0
- if (multisample) {
- /* maybe someday */
- }
-#endif
-}
-
-
/**
* Deallocate buffer and everything attached to it.
+ * Typically called via the gl_framebuffer->Delete() method.
*/
void
-_mesa_destroy_framebuffer(struct gl_framebuffer *buffer)
+_mesa_destroy_framebuffer(struct gl_framebuffer *fb)
{
- if (buffer) {
- _mesa_free_framebuffer_data(buffer);
- FREE(buffer);
+ if (fb) {
+ _mesa_free_framebuffer_data(fb);
+ FREE(fb);
}
}
/**
* The glGet queries of the framebuffer red/green/blue size, stencil size,
* etc. are satisfied by the fields of ctx->DrawBuffer->Visual. These can
- * change depending on the renderbuffer bindings. This function update's
+ * change depending on the renderbuffer bindings. This function updates
* the given framebuffer's Visual from the current renderbuffer bindings.
* This is only intended for user-created framebuffers.
*/
/*
* Update the list of drawing renderbuffer pointers.
* Later, when we're rendering we'll loop from 0 to _NumColorDrawBuffers
- * writing colors. We have a loop because glDrawBuffer(GL_FRONT_AND_BACK)
- * can specify writing to two or four color buffers.
+ * writing colors. We need the inner loop here because
+ * glDrawBuffer(GL_FRONT_AND_BACK) can specify writing to two or four
+ * color buffers (for example).
*/
for (output = 0; output < ctx->Const.MaxDrawBuffers; output++) {
GLuint bufferMask = fb->_ColorDrawBufferMask[output];
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
#include "renderbuffer.h"
+/* 32-bit color index format. Not a public format. */
#define COLOR_INDEX32 0x424243
*/
/**********************************************************************
- * Functions for buffers of 1 X GLushort values.
+ * Functions for buffers of 1 X GLubyte values.
* Typically stencil.
*/
}
+/**
+ * Create/attach software-based renderbuffers to the given framebuffer.
+ * This is a helper routine for device drivers. Drivers can just as well
+ * call the individual _mesa_add_*_renderbuffer() routines directly.
+ */
+void
+_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
+ GLboolean color,
+ GLboolean depth,
+ GLboolean stencil,
+ GLboolean accum,
+ GLboolean alpha,
+ GLboolean aux)
+{
+ GLboolean frontLeft = GL_TRUE;
+ GLboolean backLeft = fb->Visual.doubleBufferMode;
+ GLboolean frontRight = fb->Visual.stereoMode;
+ GLboolean backRight = fb->Visual.stereoMode && fb->Visual.doubleBufferMode;
+
+ if (color) {
+ if (fb->Visual.rgbMode) {
+ assert(fb->Visual.redBits == fb->Visual.greenBits);
+ assert(fb->Visual.redBits == fb->Visual.blueBits);
+ _mesa_add_color_renderbuffers(NULL, fb,
+ fb->Visual.redBits,
+ fb->Visual.alphaBits,
+ frontLeft, backLeft,
+ frontRight, backRight);
+ }
+ else {
+ _mesa_add_color_index_renderbuffers(NULL, fb,
+ fb->Visual.indexBits,
+ frontLeft, backLeft,
+ frontRight, backRight);
+ }
+ }
+
+ if (depth) {
+ assert(fb->Visual.depthBits > 0);
+ _mesa_add_depth_renderbuffer(NULL, fb, fb->Visual.depthBits);
+ }
+
+ if (stencil) {
+ assert(fb->Visual.stencilBits > 0);
+ _mesa_add_stencil_renderbuffer(NULL, fb, fb->Visual.stencilBits);
+ }
+
+ if (accum) {
+ assert(fb->Visual.rgbMode);
+ assert(fb->Visual.accumRedBits > 0);
+ assert(fb->Visual.accumGreenBits > 0);
+ assert(fb->Visual.accumBlueBits > 0);
+ _mesa_add_accum_renderbuffer(NULL, fb,
+ fb->Visual.accumRedBits,
+ fb->Visual.accumGreenBits,
+ fb->Visual.accumBlueBits,
+ fb->Visual.accumAlphaBits);
+ }
+
+ if (aux) {
+ assert(fb->Visual.rgbMode);
+ assert(fb->Visual.numAuxBuffers > 0);
+ _mesa_add_aux_renderbuffers(NULL, fb, fb->Visual.redBits,
+ fb->Visual.numAuxBuffers);
+ }
+
+ if (alpha) {
+ assert(fb->Visual.rgbMode);
+ assert(fb->Visual.alphaBits > 0);
+ _mesa_add_alpha_renderbuffers(NULL, fb, fb->Visual.alphaBits,
+ frontLeft, backLeft,
+ frontRight, backRight);
+ }
+
+#if 0
+ if (multisample) {
+ /* maybe someday */
+ }
+#endif
+}
+
/**
* Attach a renderbuffer to a framebuffer.