swrast: Remove support for Clear into a color-index buffer

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Ian Romanick
2010-02-24 15:45:36 -08:00
parent e5ed4c45c6
commit 9e2d30e0b8
+6 -103
View File
@@ -51,7 +51,6 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb,
SWspan span;
GLint i;
ASSERT(ctx->Visual.rgbMode);
ASSERT(rb->PutRow);
/* Initialize color span with clear color */
@@ -104,45 +103,6 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb,
}
/**
* Clear color index buffer with masking.
*/
static void
clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
{
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;
SWspan span;
GLint i;
ASSERT(!ctx->Visual.rgbMode);
ASSERT(rb->PutRow);
ASSERT(rb->DataType == GL_UNSIGNED_INT);
/* Initialize index span with clear index */
INIT_SPAN(span, GL_BITMAP);
span.end = width;
span.arrayMask = SPAN_INDEX;
for (i = 0; i < width;i++) {
span.array->index[i] = ctx->Color.ClearIndex;
}
/* Note that masking will change the color indexes, but only the
* bits for which the write mask is GL_FALSE. The bits
* which are write-enabled won't get modified.
*/
for (i = 0; i < height;i++) {
span.x = x;
span.y = y + i;
_swrast_mask_ci_span(ctx, rb, &span);
/* write masked row */
rb->PutRow(ctx, rb, width, x, y + i, span.array->index, NULL);
}
}
/**
* Clear an rgba color buffer without channel masking.
*/
@@ -158,8 +118,6 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf)
GLvoid *clearVal;
GLint i;
ASSERT(ctx->Visual.rgbMode);
ASSERT(ctx->Color.ColorMask[buf][0] &&
ctx->Color.ColorMask[buf][1] &&
ctx->Color.ColorMask[buf][2] &&
@@ -196,50 +154,6 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf)
}
/**
* Clear color index buffer without masking.
*/
static void
clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
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;
GLushort clear16;
GLuint clear32;
GLvoid *clearVal;
GLint i;
ASSERT(!ctx->Visual.rgbMode);
ASSERT(rb->PutMonoRow);
/* setup clear value */
switch (rb->DataType) {
case GL_UNSIGNED_BYTE:
clear8 = (GLubyte) ctx->Color.ClearIndex;
clearVal = &clear8;
break;
case GL_UNSIGNED_SHORT:
clear16 = (GLushort) ctx->Color.ClearIndex;
clearVal = &clear16;
break;
case GL_UNSIGNED_INT:
clear32 = ctx->Color.ClearIndex;
clearVal = &clear32;
break;
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);
}
/**
* Clear the front/back/left/right/aux color buffers.
* This function is usually only called if the device driver can't
@@ -252,25 +166,14 @@ clear_color_buffers(GLcontext *ctx)
for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[buf];
if (ctx->Visual.rgbMode) {
if (ctx->Color.ColorMask[buf][0] == 0 ||
ctx->Color.ColorMask[buf][1] == 0 ||
ctx->Color.ColorMask[buf][2] == 0 ||
ctx->Color.ColorMask[buf][3] == 0) {
clear_rgba_buffer_with_masking(ctx, rb, buf);
}
else {
clear_rgba_buffer(ctx, rb, buf);
}
if (ctx->Color.ColorMask[buf][0] == 0 ||
ctx->Color.ColorMask[buf][1] == 0 ||
ctx->Color.ColorMask[buf][2] == 0 ||
ctx->Color.ColorMask[buf][3] == 0) {
clear_rgba_buffer_with_masking(ctx, rb, buf);
}
else {
const GLuint indexMask = (1 << _mesa_get_format_bits(rb->Format, GL_INDEX_BITS)) - 1;
if ((ctx->Color.IndexMask & indexMask) != indexMask) {
clear_ci_buffer_with_masking(ctx, rb);
}
else {
clear_ci_buffer(ctx, rb);
}
clear_rgba_buffer(ctx, rb, buf);
}
}
}