const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax / fb_width * 2.0f - 1.0f;
const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin / fb_height * 2.0f - 1.0f;
const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax / fb_height * 2.0f - 1.0f;
- union pipe_color_union clearColor;
unsigned num_layers =
util_framebuffer_get_num_layers(&st->state.framebuffer);
else
set_vertex_shader(st);
- if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
- GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat);
-
- st_translate_color(&ctx->Color.ClearColor,
- &clearColor,
- ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- is_integer);
- }
+ /* We can't translate the clear color to the colorbuffer format,
+ * because different colorbuffers may have different formats.
+ */
/* draw quad matching scissor rect */
draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, num_layers,
- &clearColor);
+ (union pipe_color_union*)&ctx->Color.ClearColor);
/* Restore pipe state */
cso_restore_blend(st->cso_context);
quad_buffers & PIPE_CLEAR_DEPTH,
quad_buffers & PIPE_CLEAR_STENCIL);
} else if (clear_buffers) {
- union pipe_color_union clearColor;
-
- if (ctx->DrawBuffer->_ColorDrawBuffers[0]) {
- struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
- GLboolean is_integer = _mesa_is_enum_format_integer(rb->InternalFormat);
-
- st_translate_color(&ctx->Color.ClearColor,
- &clearColor,
- ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat,
- is_integer);
- }
-
- st->pipe->clear(st->pipe, clear_buffers, &clearColor,
+ /* We can't translate the clear color to the colorbuffer format,
+ * because different colorbuffers may have different formats.
+ */
+ st->pipe->clear(st->pipe, clear_buffers,
+ (union pipe_color_union*)&ctx->Color.ClearColor,
ctx->Depth.Clear, ctx->Stencil.Clear);
}
if (mask & BUFFER_BIT_ACCUM)