summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_context.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-04-20 04:32:24 +0200
committerMarek Olšák <[email protected]>2014-04-25 01:33:12 +0200
commite522c455e40b06a89885d413d564df40015259b3 (patch)
tree4fb74ff1af81b0c18a61203d6a26685ea30a912a /src/gallium/drivers/r300/r300_context.h
parentba4f6a5fc93b80d23f8a355c219020e2022439f8 (diff)
r300g: don't crash when getting NULL colorbuffers
Diffstat (limited to 'src/gallium/drivers/r300/r300_context.h')
-rw-r--r--src/gallium/drivers/r300/r300_context.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index e6b0181cd84..8736cc73492 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -688,6 +688,20 @@ static INLINE void r300_mark_atom_dirty(struct r300_context *r300,
}
}
+static INLINE struct pipe_surface *
+r300_get_nonnull_cb(struct pipe_framebuffer_state *fb, unsigned i)
+{
+ if (fb->cbufs[i])
+ return fb->cbufs[i];
+
+ /* The i-th framebuffer is NULL, return any non-NULL one. */
+ for (i = 0; i < fb->nr_cbufs; i++)
+ if (fb->cbufs[i])
+ return fb->cbufs[i];
+
+ return NULL;
+}
+
struct pipe_context* r300_create_context(struct pipe_screen* screen,
void *priv);