Mesa (master): gallium/util: easy fixes for NULL colorbuffers
Marek Olšák
mareko at kemper.freedesktop.org
Mon Jan 13 14:50:08 UTC 2014
Module: Mesa
Branch: master
Commit: 9677cfab323ef0a24b40711895333685c63258ac
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9677cfab323ef0a24b40711895333685c63258ac
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Jan 8 01:07:20 2014 +0100
gallium/util: easy fixes for NULL colorbuffers
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/gallium/auxiliary/util/u_clear.h | 5 ++++-
src/gallium/auxiliary/util/u_framebuffer.c | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h
index 75047c1..bd8efdb 100644
--- a/src/gallium/auxiliary/util/u_clear.h
+++ b/src/gallium/auxiliary/util/u_clear.h
@@ -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);
+ }
}
}
diff --git a/src/gallium/auxiliary/util/u_framebuffer.c b/src/gallium/auxiliary/util/u_framebuffer.c
index 377b802..2e0ef74 100644
--- a/src/gallium/auxiliary/util/u_framebuffer.c
+++ b/src/gallium/auxiliary/util/u_framebuffer.c
@@ -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);
}
More information about the mesa-commit
mailing list