renderer: fix separate buffer clears

this fixes clearbuffer-mixed-format
macos/master
Dave Airlie 9 years ago
parent 0b7af0a6b2
commit e66e915087
  1. 27
      src/vrend_renderer.c

@ -2335,12 +2335,37 @@ void vrend_clear(struct vrend_context *ctx,
if (buffers & PIPE_CLEAR_STENCIL)
glClearStencil(stencil);
if (buffers & PIPE_CLEAR_COLOR)
if (buffers & PIPE_CLEAR_COLOR) {
uint32_t mask = 0;
int i;
for (i = 0; i < ctx->sub->nr_cbufs; i++) {
if (ctx->sub->surf[i])
mask |= (1 << i);
}
if (mask != (buffers >> 2)) {
mask = buffers >> 2;
while (mask) {
i = u_bit_scan(&mask);
if (util_format_is_pure_uint(ctx->sub->surf[i]->format))
glClearBufferuiv(GL_COLOR,
i, (GLuint *)color);
else if (util_format_is_pure_sint(ctx->sub->surf[i]->format))
glClearBufferiv(GL_COLOR,
i, (GLint *)color);
else
glClearBufferfv(GL_COLOR,
i, (GLfloat *)color);
}
}
else
bits |= GL_COLOR_BUFFER_BIT;
}
if (buffers & PIPE_CLEAR_DEPTH)
bits |= GL_DEPTH_BUFFER_BIT;
if (buffers & PIPE_CLEAR_STENCIL)
bits |= GL_STENCIL_BUFFER_BIT;
if (bits)
glClear(bits);
if (buffers & PIPE_CLEAR_DEPTH)

Loading…
Cancel
Save