swr/rast: Initial work for debugging support.
[mesa.git] / src / gallium / drivers / llvmpipe / lp_state_surface.c
index c879ba9751d49f4539dbd1e6ad7955cb9cddeacd..b20b9c5cdd5e0db9aa3916efc24c8f7734d57d12 100644 (file)
@@ -52,6 +52,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
    struct llvmpipe_context *lp = llvmpipe_context(pipe);
 
    boolean changed = !util_framebuffer_state_equal(&lp->framebuffer, fb);
+   unsigned i;
 
    assert(fb->width <= LP_MAX_WIDTH);
    assert(fb->height <= LP_MAX_HEIGHT);
@@ -66,10 +67,22 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
       const struct util_format_description *depth_desc =
          util_format_description(depth_format);
 
+      if (lp->framebuffer.zsbuf && lp->framebuffer.zsbuf->context != pipe) {
+         debug_printf("Illegal setting of fb state with zsbuf created in "
+                       "another context\n");
+      }
+      for (i = 0; i < fb->nr_cbufs; i++) {
+         if (lp->framebuffer.cbufs[i] &&
+             lp->framebuffer.cbufs[i]->context != pipe) {
+            debug_printf("Illegal setting of fb state with cbuf %d created in "
+                          "another context\n", i);
+         }
+      }
+
       util_copy_framebuffer_state(&lp->framebuffer, fb);
 
       if (LP_PERF & PERF_NO_DEPTH) {
-        pipe_surface_reference(&lp->framebuffer.zsbuf, NULL);
+         pipe_surface_reference(&lp->framebuffer.zsbuf, NULL);
       }
 
       /*