summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-09-13 23:37:50 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-09-13 23:37:50 +0000
commitf084f60f8bdba23b3f6125549045c0791d3fe138 (patch)
treee367bc5dcaeb56184ddb2bce0280115497f47912 /src/mesa/main
parent7909dd920deadadbfaa2add0225e333a2af6cb56 (diff)
Move _mesa_add_soft_renderbuffers() from framebuffer.c to renderbuffer.c
Update some comments, code, etc.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/framebuffer.c106
-rw-r--r--src/mesa/main/framebuffer.h11
-rw-r--r--src/mesa/main/renderbuffer.c86
-rw-r--r--src/mesa/main/renderbuffer.h11
4 files changed, 107 insertions, 107 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 0c620f7908d..6fab6eaa9f8 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -103,7 +103,6 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name)
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;
@@ -115,7 +114,8 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name)
/**
- * 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
@@ -150,98 +150,15 @@ _mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual)
/**
- * 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);
}
}
@@ -398,7 +315,7 @@ _mesa_update_draw_buffer_bounds(GLcontext *ctx)
/**
* 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.
*/
@@ -481,8 +398,9 @@ _mesa_update_framebuffer(GLcontext *ctx)
/*
* 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];
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index 11b002877c9..fcc493c1937 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -37,15 +37,6 @@ extern void
_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual);
extern void
-_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
- GLboolean color,
- GLboolean depth,
- GLboolean stencil,
- GLboolean accum,
- GLboolean alpha,
- GLboolean aux);
-
-extern void
_mesa_destroy_framebuffer(struct gl_framebuffer *buffer);
extern void
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 480906533fd..d678f9c6749 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -48,6 +48,7 @@
#include "renderbuffer.h"
+/* 32-bit color index format. Not a public format. */
#define COLOR_INDEX32 0x424243
@@ -58,7 +59,7 @@
*/
/**********************************************************************
- * Functions for buffers of 1 X GLushort values.
+ * Functions for buffers of 1 X GLubyte values.
* Typically stencil.
*/
@@ -1835,6 +1836,87 @@ _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
}
+/**
+ * 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.
diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h
index 5c11de7c8a3..fb3f3572f60 100644
--- a/src/mesa/main/renderbuffer.h
+++ b/src/mesa/main/renderbuffer.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
@@ -78,6 +78,15 @@ _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
GLuint bits, GLuint numBuffers);
extern void
+_mesa_add_soft_renderbuffers(struct gl_framebuffer *fb,
+ GLboolean color,
+ GLboolean depth,
+ GLboolean stencil,
+ GLboolean accum,
+ GLboolean alpha,
+ GLboolean aux);
+
+extern void
_mesa_add_renderbuffer(struct gl_framebuffer *fb,
GLuint bufferName, struct gl_renderbuffer *rb);