Mesa (lp-binning): gallium/util: added framebuffer compare, copy util funcs

Brian Paul brianp at kemper.freedesktop.org
Thu Dec 10 21:56:53 UTC 2009


Module: Mesa
Branch: lp-binning
Commit: a67f39810b5c88367ae2a9ee564b1a740b27601b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a67f39810b5c88367ae2a9ee564b1a740b27601b

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Dec 10 14:54:57 2009 -0700

gallium/util: added framebuffer compare, copy util funcs

---

 src/gallium/auxiliary/util/u_surface.c |   49 ++++++++++++++++++++++++++++++++
 src/gallium/auxiliary/util/u_surface.h |    9 ++++++
 2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 85e4432..a95b887 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -36,6 +36,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 
+#include "util/u_memory.h"
 #include "util/u_surface.h"
 
 
@@ -111,3 +112,51 @@ util_destroy_rgba_surface(struct pipe_texture *texture,
    pipe_texture_reference(&texture, NULL);
 }
 
+
+
+/**
+ * Compare pipe_framebuffer_state objects.
+ * \return TRUE if same, FALSE if different
+ */
+boolean
+util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst,
+                             const struct pipe_framebuffer_state *src)
+{
+   boolean changed = FALSE;
+   unsigned i;
+
+   for (i = 0; i < Elements(src->cbufs); i++) {
+      if (dst->cbufs[i] != src->cbufs[i]) {
+         changed = TRUE;
+      }
+   }
+
+   if (dst->nr_cbufs != src->nr_cbufs) {
+      changed = TRUE;
+   }
+
+   if (dst->zsbuf != src->zsbuf) {
+      changed = TRUE;
+   }
+
+   return changed;
+}
+
+
+/**
+ * Copy framebuffer state from src to dst, updating refcounts.
+ */
+void
+util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
+                            const struct pipe_framebuffer_state *src)
+{
+   unsigned i;
+
+   for (i = 0; i < Elements(src->cbufs); i++) {
+      pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
+   }
+
+   dst->nr_cbufs = src->nr_cbufs;
+
+   pipe_surface_reference(&dst->zsbuf, src->zsbuf);
+}
diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h
index ce84ed7..a9da9aa 100644
--- a/src/gallium/auxiliary/util/u_surface.h
+++ b/src/gallium/auxiliary/util/u_surface.h
@@ -66,4 +66,13 @@ util_destroy_rgba_surface(struct pipe_texture *texture,
                           struct pipe_surface *surface);
 
 
+extern boolean
+util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst,
+                             const struct pipe_framebuffer_state *src);
+
+extern void
+util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
+                            const struct pipe_framebuffer_state *src);
+
+
 #endif /* U_SURFACE_H */




More information about the mesa-commit mailing list