gallium/util: easy fixes for NULL colorbuffers

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Marek Olšák 2014-01-08 01:07:20 +01:00
parent 9baa45f78b
commit 9677cfab32
2 changed files with 7 additions and 1 deletions

View file

@ -47,7 +47,10 @@ util_clear(struct pipe_context *pipe,
for (i = 0; i < framebuffer->nr_cbufs; i++) {
if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
struct pipe_surface *ps = framebuffer->cbufs[i];
pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width, ps->height);
if (ps) {
pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width, ps->height);
}
}
}

View file

@ -127,6 +127,9 @@ util_framebuffer_min_size(const struct pipe_framebuffer_state *fb,
unsigned i;
for (i = 0; i < fb->nr_cbufs; i++) {
if (!fb->cbufs[i])
continue;
w = MIN2(w, fb->cbufs[i]->width);
h = MIN2(h, fb->cbufs[i]->height);
}