Mesa (lp-binning): gallium/util: simplify util_framebuffer_state_equal()

Brian Paul brianp at kemper.freedesktop.org
Fri Dec 11 17:01:19 PST 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Dec 11 11:39:53 2009 -0700

gallium/util: simplify util_framebuffer_state_equal()

And copy width, height in util_copy_framebuffer_state().

---

 src/gallium/auxiliary/util/u_surface.c |   16 +++++++++++-----
 src/gallium/auxiliary/util/u_surface.h |   10 +++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index a95b887..daaa275 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -122,24 +122,27 @@ boolean
 util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst,
                              const struct pipe_framebuffer_state *src)
 {
-   boolean changed = FALSE;
    unsigned i;
 
+   if (dst->width != src->width ||
+       dst->height != src->height)
+      return FALSE;
+
    for (i = 0; i < Elements(src->cbufs); i++) {
       if (dst->cbufs[i] != src->cbufs[i]) {
-         changed = TRUE;
+         return FALSE;
       }
    }
 
    if (dst->nr_cbufs != src->nr_cbufs) {
-      changed = TRUE;
+      return FALSE;
    }
 
    if (dst->zsbuf != src->zsbuf) {
-      changed = TRUE;
+      return FALSE;
    }
 
-   return changed;
+   return TRUE;
 }
 
 
@@ -152,6 +155,9 @@ util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
 {
    unsigned i;
 
+   dst->width = src->width;
+   dst->height = src->height;
+
    for (i = 0; i < Elements(src->cbufs); i++) {
       pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
    }
diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h
index a9da9aa..3c60df2 100644
--- a/src/gallium/auxiliary/util/u_surface.h
+++ b/src/gallium/auxiliary/util/u_surface.h
@@ -30,11 +30,7 @@
 
 
 #include "pipe/p_compiler.h"
-
-
-struct pipe_screen;
-struct pipe_texture;
-struct pipe_surface;
+#include "pipe/p_state.h"
 
 
 /**
@@ -75,4 +71,8 @@ util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
                             const struct pipe_framebuffer_state *src);
 
 
+extern void
+util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb);
+
+
 #endif /* U_SURFACE_H */



More information about the mesa-commit mailing list