static void
clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
GLint i;
ASSERT(ctx->Visual.rgbMode);
+ ASSERT(rb->PutRow);
CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]);
CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]);
COPY_CHAN4(rgba[j], clearColor);
}
_swrast_mask_rgba_array( ctx, rb, width, x, y + i, rgba );
-#if NEW_RENDERBUFFER
- if (rb->PutRow) {
- rb->PutRow(ctx, rb, width, x, y + i, rgba, NULL);
- }
-#endif
-#if OLD_RENDERBUFFER
- else {
- swrast->Driver.WriteRGBASpan(ctx, rb, width, x, y + i,
- (CONST GLchan (*)[4]) rgba, NULL);
- }
-#endif
+ rb->PutRow(ctx, rb, width, x, y + i, rgba, NULL);
}
}
static void
clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
- SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+ GLubyte clear8[4];
+ GLushort clear16[4];
+ GLvoid *clearVal;
GLint i;
ASSERT(ctx->Visual.rgbMode);
ctx->Color.ColorMask[2] &&
ctx->Color.ColorMask[3]);
-#if NEW_RENDERBUFFER
- if (rb->PutMonoRow) { /* XXX assert this */
- GLubyte clear8[4];
- GLushort clear16[4];
- GLvoid *clearVal;
- switch (rb->DataType) {
+ ASSERT(rb->PutMonoRow);
+
+ switch (rb->DataType) {
case GL_UNSIGNED_BYTE:
clear8[0] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[0]);
clear8[1] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[1]);
default:
_mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
return;
- }
- for (i = 0; i < height; i++) {
- rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
- }
}
-#endif
-#if OLD_RENDERBUFFER
- else {
- GLchan clearColor[4];
- CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]);
- CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]);
- CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]);
- CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]);
- ASSERT(swrast->Driver.WriteRGBASpan);
- for (i = 0; i < height; i++) {
- swrast->Driver.WriteMonoRGBASpan(ctx, rb, width, x, y + i,
- clearColor, NULL );
- }
+
+ for (i = 0; i < height; i++) {
+ rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
}
-#endif
}
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
+ GLubyte clear8;
+ GLushort clear16;
+ GLuint clear32;
+ GLvoid *clearVal;
+ GLint i;
ASSERT(!ctx->Visual.rgbMode);
ASSERT((ctx->Color.IndexMask & ((1 << ctx->Visual.indexBits) - 1))
== (GLuint) ((1 << ctx->Visual.indexBits) - 1));
-#if NEW_RENDERBUFFER
- if (rb->PutMonoRow) { /* XXX assert this */
- GLubyte clear8;
- GLushort clear16;
- GLuint clear32;
- GLvoid *clearVal;
- GLint i;
- switch (rb->DataType) {
+ ASSERT(rb->PutMonoRow);
+
+ /* setup clear value */
+ switch (rb->DataType) {
case GL_UNSIGNED_BYTE:
clear8 = (GLubyte) ctx->Color.ClearIndex;
clearVal = &clear8;
default:
_mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
return;
- }
- for (i = 0; i < height; i++)
- rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
}
-#endif
+
+ for (i = 0; i < height; i++)
+ rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
}
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers[0]; i++) {
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][i];
-#if OLD_RENDERBUFFER /* this is obsolete code */
- if (swrast->Driver.SetBuffer)
- swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer,
+#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
+ /* SetBuffer will go away */
+ swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer,
ctx->DrawBuffer->_ColorDrawBit[0][i]);
#endif