Mesa (master): glhd: Grab framebuffer state checks from r300g.

Corbin Simpson csimpson at kemper.freedesktop.org
Wed Jun 23 00:12:50 PDT 2010


Module: Mesa
Branch: master
Commit: aa451d509df844e4652853f08e31bc1ee18c04ac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa451d509df844e4652853f08e31bc1ee18c04ac

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Tue Jun 22 23:00:44 2010 -0700

glhd: Grab framebuffer state checks from r300g.

---

 src/gallium/drivers/galahad/glhd_context.c |   10 ++++++++++
 src/gallium/drivers/galahad/glhd_context.h |    3 +++
 src/gallium/drivers/r300/r300_state.c      |    6 ------
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
index 6dfee2c..7a856ef 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -497,6 +497,16 @@ galahad_set_framebuffer_state(struct pipe_context *_pipe,
    struct pipe_framebuffer_state *state = NULL;
    unsigned i;
 
+   if (_state->nr_cbufs > PIPE_MAX_COLOR_BUFS) {
+      glhd_error("%d render targets bound, but only %d are permitted by API",
+         _state->nr_cbufs, PIPE_MAX_COLOR_BUFS);
+   } else if (_state->nr_cbufs >
+      pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_RENDER_TARGETS)) {
+      glhd_warn("%d render targets bound, but only %d are supported",
+         _state->nr_cbufs,
+         pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_RENDER_TARGETS));
+   }
+
    /* unwrap the input state */
    if (_state) {
       memcpy(&unwrapped_state, _state, sizeof(unwrapped_state));
diff --git a/src/gallium/drivers/galahad/glhd_context.h b/src/gallium/drivers/galahad/glhd_context.h
index a8753d0..4e71753 100644
--- a/src/gallium/drivers/galahad/glhd_context.h
+++ b/src/gallium/drivers/galahad/glhd_context.h
@@ -58,4 +58,7 @@ do { \
     fprintf(stderr, "\n"); \
 } while (0)
 
+#define glhd_error(...) \
+    glhd_warn(__VA_ARGS__);
+
 #endif /* GLHD_CONTEXT_H */
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index bc2b62b..927e936 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -668,12 +668,6 @@ static void
     unsigned max_width, max_height, i;
     uint32_t zbuffer_bpp = 0;
 
-    if (state->nr_cbufs > 4) {
-        fprintf(stderr, "r300: Implementation error: Too many MRTs in %s, "
-            "refusing to bind framebuffer state!\n", __FUNCTION__);
-        return;
-    }
-
     if (r300->screen->caps.is_r500) {
         max_width = max_height = 4096;
     } else if (r300->screen->caps.is_r400) {



More information about the mesa-commit mailing list