driver->ColorMask = NULL;
driver->ColorMaterial = NULL;
driver->CullFace = NULL;
- driver->DrawBuffer = _swrast_DrawBuffer;
- driver->DrawBuffers = NULL; /***_swrast_DrawBuffers;***/
+ driver->DrawBuffer = NULL;
+ driver->DrawBuffers = NULL;
driver->FrontFace = NULL;
driver->DepthFunc = NULL;
driver->DepthMask = NULL;
#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
-/* XXX everything marked with OLD_RENDERBUFFER will be going away... */
-#define OLD_RENDERBUFFER 1
-
-
#endif /* CONFIG_H */
* Update state related to the current draw/read framebuffers.
* Specifically, update these framebuffer fields:
* _ColorDrawBuffers
- * _ColorDrawBit
* _NumColorDrawBuffers
* _ColorReadBuffer
* If the current framebuffer is user-created, make sure it's complete.
struct gl_renderbuffer *rb = get_renderbuffer(fb, bufferBit);
if (rb) {
fb->_ColorDrawBuffers[output][count] = rb;
- fb->_ColorDrawBit[output][count] = bufferBit;
count++;
}
else {
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS][4];
struct gl_renderbuffer *_ColorReadBuffer;
-#if OLD_RENDERBUFFER
- /* XXX THIS IS TEMPORARY */
- GLuint _ColorDrawBit[MAX_DRAW_BUFFERS][4];
-#endif
-
/** Delete this framebuffer */
void (*Delete)(struct gl_framebuffer *fb);
};
{
assert(fb);
assert(rb);
+#if 00
/* there should be no previous renderbuffer on this attachment point! */
assert(fb->Attachment[bufferName].Renderbuffer == NULL);
+#endif
assert(bufferName < BUFFER_COUNT);
/* winsys vs. user-created buffer cross check */
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler)
rescale_accum(ctx);
- _swrast_use_read_buffer(ctx);
-
if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF;
GLshort accumRow[4 * MAX_WIDTH];
else {
/* other types someday */
}
-
- _swrast_use_draw_buffer(ctx);
}
swrast->_IntegerAccumScaler = 0.0;
}
- _swrast_use_read_buffer(ctx);
-
if (rb->DataType == GL_SHORT || rb->DataType == GL_UNSIGNED_SHORT) {
const GLfloat scale = value * ACCUM_SCALE16 / CHAN_MAXF;
GLshort accumRow[4 * MAX_WIDTH];
else {
/* other types someday */
}
-
- _swrast_use_draw_buffer(ctx);
}
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers[0]; i++) {
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][i];
-#if OLD_RENDERBUFFER
- /* SetBuffer will go away */
- if (swrast->Driver.SetBuffer)
- swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer,
- ctx->DrawBuffer->_ColorDrawBit[0][i]);
-#endif
-
if (ctx->Visual.rgbMode) {
if (masking) {
clear_rgba_buffer_with_masking(ctx, rb);
}
}
}
-
- /* restore default read/draw buffer */
- _swrast_use_draw_buffer(ctx);
}
RENDER_FINISH(swrast,ctx);
}
-
-
-/*
- * Fallback for ctx->Driver.DrawBuffer()
- */
-void
-_swrast_DrawBuffer( GLcontext *ctx, GLenum mode )
-{
- (void) mode;
- _swrast_use_draw_buffer(ctx);
-}
-
-
-/*
- * Fallback for ctx->Driver.DrawBuffers()
- */
-void
-_swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers )
-{
- _swrast_use_draw_buffer(ctx);
-}
-
-
-/*
- * Setup things so that we read/write spans from the user-designated
- * read buffer (set via glReadPixels). We usually just have to call
- * this for glReadPixels, glCopyPixels, etc.
- *
- * XXX this will go away when the last OLD_RENDERBUFFER code is removed.
- * The swrast->CurrentBufferBit var can be totally removed then too.
- */
-void
-_swrast_use_read_buffer( GLcontext *ctx )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- /* Do this so the software-emulated alpha plane span functions work! */
- swrast->CurrentBufferBit = ctx->ReadBuffer->_ColorReadBufferMask;
- /* Tell the device driver where to read/write spans */
- if (swrast->Driver.SetBuffer)
- swrast->Driver.SetBuffer(ctx, ctx->ReadBuffer, swrast->CurrentBufferBit);
-}
-
-
-/*
- * Setup things so that we read/write spans from the default draw buffer.
- * This is the usual mode that Mesa's software rasterizer operates in.
- *
- * XXX this will go away when the last OLD_RENDERBUFFER code is removed.
- * The swrast->CurrentBufferBit var can be totally removed then too.
- */
-void
-_swrast_use_draw_buffer( GLcontext *ctx )
-{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-
- /* The user can specify rendering to zero, one, two, or four color
- * buffers simultaneously with glDrawBuffer()!
- * We don't expect the span/point/line/triangle functions to deal with
- * that mess so we'll iterate over the multiple buffers as needed.
- * But usually we only render to one color buffer at a time.
- * We set ctx->Color._DriverDrawBuffer to that buffer and tell the
- * device driver to use that buffer.
- * Look in s_span.c's multi_write_rgba_span() function to see how
- * we loop over multiple color buffers when needed.
- */
-
- if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT)
- swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_LEFT)
- swrast->CurrentBufferBit = BUFFER_BIT_BACK_LEFT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_RIGHT)
- swrast->CurrentBufferBit = BUFFER_BIT_FRONT_RIGHT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_BACK_RIGHT)
- swrast->CurrentBufferBit = BUFFER_BIT_BACK_RIGHT;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX0)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX0;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX1)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX1;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX2)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX2;
- else if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_AUX3)
- swrast->CurrentBufferBit = BUFFER_BIT_AUX3;
- else
- /* glDrawBuffer(GL_NONE) */
- swrast->CurrentBufferBit = BUFFER_BIT_FRONT_LEFT; /* we always have this buffer */
-
- if (swrast->Driver.SetBuffer)
- swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer, swrast->CurrentBufferBit);
-}
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
struct gl_renderbuffer *drawRb = NULL;
GLboolean quick_draw;
GLint row;
- GLboolean changeBuffer;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
const GLuint transferOps = ctx->_ImageTransferState;
GLfloat *dest, *tmpImage, *convImage;
quick_draw = GL_FALSE;
}
- /* If read and draw buffer are different we must do buffer switching */
- changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0]
- || ctx->DrawBuffer != ctx->ReadBuffer;
-
-
/* allocate space for GLfloat image */
tmpImage = (GLfloat *) MALLOC(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
return;
}
- if (changeBuffer) {
- /* choose the read buffer */
- _swrast_use_read_buffer(ctx);
- }
-
/* read source image */
dest = tmpImage;
for (row = 0; row < height; row++) {
dest += 4 * width;
}
- if (changeBuffer) {
- /* restore default src/dst buffer */
- _swrast_use_draw_buffer(ctx);
- }
-
/* do the image transfer ops which preceed convolution */
for (row = 0; row < height; row++) {
GLfloat (*rgba)[4] = (GLfloat (*)[4]) (tmpImage + row * width * 4);
GLchan *tmpImage,*p;
GLboolean quick_draw;
GLint sy, dy, stepy, j;
- GLboolean changeBuffer;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
GLint overlapping;
const GLuint transferOps = ctx->_ImageTransferState;
drawRb = NULL;
}
- /* If read and draw buffer are different we must do buffer switching */
- changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0]
- || ctx->DrawBuffer != ctx->ReadBuffer;
-
if (overlapping) {
GLint ssy = sy;
tmpImage = (GLchan *) MALLOC(width * height * sizeof(GLchan) * 4);
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
}
- /* setup source */
- if (changeBuffer)
- _swrast_use_read_buffer(ctx);
/* read the source image */
p = tmpImage;
for (j = 0; j < height; j++, ssy += stepy) {
p += width * 4;
}
p = tmpImage;
- /* restore dest */
- if (changeBuffer) {
- _swrast_use_draw_buffer(ctx);
- changeBuffer = GL_FALSE;
- }
}
else {
tmpImage = NULL; /* silence compiler warnings */
}
else {
/* get from framebuffer */
- if (changeBuffer)
- _swrast_use_read_buffer(ctx);
ASSERT(width < MAX_WIDTH);
_swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
width, srcx, sy, span.array->rgba );
- if (changeBuffer)
- _swrast_use_draw_buffer(ctx);
}
if (transferOps) {
GLuint *tmpImage,*p;
GLint sy, dy, stepy;
GLint j;
- GLboolean changeBuffer;
const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset;
GLint overlapping;
if (ctx->Fog.Enabled)
_swrast_span_default_fog(ctx, &span);
- /* If read and draw buffer are different we must do buffer switching */
- changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer[0]
- || ctx->DrawBuffer != ctx->ReadBuffer;
-
if (overlapping) {
GLint ssy = sy;
tmpImage = (GLuint *) MALLOC(width * height * sizeof(GLuint));
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
}
- /* setup source */
- if (changeBuffer)
- _swrast_use_read_buffer(ctx);
/* read the image */
p = tmpImage;
for (j = 0; j < height; j++, ssy += stepy) {
p += width;
}
p = tmpImage;
- /* restore to draw buffer */
- if (changeBuffer) {
- _swrast_use_draw_buffer(ctx);
- changeBuffer = GL_FALSE;
- }
}
else {
tmpImage = NULL; /* silence compiler warning */
p += width;
}
else {
- if (changeBuffer)
- _swrast_use_read_buffer(ctx);
_swrast_read_index_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
width, srcx, sy, span.array->index );
- if (changeBuffer)
- _swrast_use_draw_buffer(ctx);
}
/* Apply shift, offset, look-up table */
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
return;
}
- /* Select buffer to read from */
- _swrast_use_read_buffer(ctx);
-
if (width > MAX_WIDTH)
width = MAX_WIDTH;
_swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
width, x, y, data );
- /* Restore reading from draw buffer (the default) */
- _swrast_use_draw_buffer(ctx);
-
/* save PBO binding */
bufferSave = ctx->Unpack.BufferObj;
ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
return;
}
- /* Select buffer to read from */
- _swrast_use_read_buffer(ctx);
-
if (width > MAX_WIDTH)
width = MAX_WIDTH;
_swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer,
width, x, y, data );
- /* Restore reading from draw buffer (the default) */
- _swrast_use_draw_buffer(ctx);
-
/* save PBO binding */
bufferSave = ctx->Unpack.BufferObj;
ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
return;
}
- /* Select buffer to read from */
- _swrast_use_read_buffer(ctx);
-
RENDER_START( swrast, ctx );
/* read the data from framebuffer */
RENDER_FINISH( swrast, ctx );
- /* Restore reading from draw buffer (the default) */
- _swrast_use_draw_buffer(ctx);
-
/* save PBO binding */
bufferSave = ctx->Unpack.BufferObj;
ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
return;
}
- /* Select buffer to read from */
- _swrast_use_read_buffer(ctx);
-
RENDER_START(swrast,ctx);
/* read pixels from framebuffer */
RENDER_FINISH(swrast,ctx);
- /* Restore reading from draw buffer (the default) */
- _swrast_use_draw_buffer(ctx);
-
/*
* HACK: save & restore context state so we can store this as a
* convolution filter via the GL api. Doesn't call any callbacks
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
return;
}
- _swrast_use_read_buffer(ctx);
-
/* XXX: width should never be > MAX_WIDTH since we did clipping earlier */
readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
_mesa_pack_index_span(ctx, readWidth, type, dest, index,
&ctx->Pack, ctx->_ImageTransferState);
}
-
- _swrast_use_draw_buffer(ctx);
}
return;
}
- _swrast_use_read_buffer(ctx);
-
/* Try optimized path first */
if (read_fast_rgba_pixels( ctx, x, y, width, height,
format, type, pixels, packing )) {
-
- _swrast_use_draw_buffer(ctx);
return; /* done! */
}
}
}
}
-
- _swrast_use_draw_buffer(ctx);
}
}
}
-#if OLD_RENDERBUFFER
- /* restore default dest buffer */
- _swrast_use_draw_buffer(ctx);
-#endif
-
span->interpMask = origInterpMask;
span->arrayMask = origArrayMask;
}
static void
multi_write_rgba_span( GLcontext *ctx, struct sw_span *span )
{
-#if OLD_RENDERBUFFER
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
-#endif
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask);
struct gl_framebuffer *fb = ctx->DrawBuffer;
const GLuint output = 0;
struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[output][i];
GLchan rgbaTmp[MAX_WIDTH][4];
-#if OLD_RENDERBUFFER
- /* obsolete code */
- GLuint bufferBit = fb->_ColorDrawBit[output][i];
- /* Set the current read/draw buffer */
- swrast->CurrentBufferBit = bufferBit;
- if (swrast->Driver.SetBuffer)
- (*swrast->Driver.SetBuffer)(ctx, ctx->DrawBuffer, bufferBit);
-#endif
-
/* make copy of incoming colors */
MEMCPY( rgbaTmp, span->array->rgba, 4 * span->end * sizeof(GLchan) );
span->array->mask);
}
}
-
-#if OLD_RENDERBUFFER
- /* restore default dest buffer */
- _swrast_use_draw_buffer(ctx);
-#endif
}
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
if (!image)
return NULL;
- /* Select buffer to read from */
- _swrast_use_read_buffer(ctx);
-
RENDER_START(swrast,ctx);
dst = image;
RENDER_FINISH(swrast,ctx);
- /* Read from draw buffer (the default) */
- _swrast_use_draw_buffer(ctx);
-
return image;
}
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
/* These are the public-access functions exported from swrast.
*/
-extern void
-_swrast_use_read_buffer( GLcontext *ctx );
-
-extern void
-_swrast_use_draw_buffer( GLcontext *ctx );
extern GLboolean
_swrast_CreateContext( GLcontext *ctx );
GLint width, GLint height );
-extern void
-_swrast_DrawBuffer( GLcontext *ctx, GLenum mode );
-
-
-extern void
-_swrast_DrawBuffers( GLcontext *ctx, GLsizei n, const GLenum *buffers );
-
/* Reset the stipple counter
*/
* Unless otherwise noted, all functions are mandatory.
*/
struct swrast_device_driver {
-#if OLD_RENDERBUFFER
- void (*SetBuffer)(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit);
- /*
- * Specifies the current color buffer for span/pixel writing/reading.
- * buffer indicates which window to write to / read from. Normally,
- * this'll be the buffer currently bound to the context, but it doesn't
- * have to be!
- * bufferBit indicates which color buffer, exactly one of:
- * DD_FRONT_LEFT_BIT - this buffer always exists
- * DD_BACK_LEFT_BIT - when double buffering
- * DD_FRONT_RIGHT_BIT - when using stereo
- * DD_BACK_RIGHT_BIT - when using stereo and double buffering
- * DD_AUXn_BIT - if aux buffers are implemented
- */
-#endif
-
/***
*** Functions for synchronizing access to the framebuffer:
***/