Mesa (master): ilo: fix compiler warnings

Chia-I Wu olv at kemper.freedesktop.org
Wed Feb 18 21:22:53 UTC 2015


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Tue Feb 17 16:10:10 2015 -0700

ilo: fix compiler warnings

Fix -Wmaybe-uninitialized warnings.  The change to
ilo_blit_resolve_slices_for_hiz() is a potential bug fix.

---

 src/gallium/drivers/ilo/ilo_blit.c   |   11 ++++-------
 src/gallium/drivers/ilo/ilo_layout.c |    7 ++++++-
 src/gallium/drivers/ilo/ilo_layout.h |    2 ++
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_blit.c b/src/gallium/drivers/ilo/ilo_blit.c
index ad6aa80..42072c2 100644
--- a/src/gallium/drivers/ilo/ilo_blit.c
+++ b/src/gallium/drivers/ilo/ilo_blit.c
@@ -190,8 +190,9 @@ ilo_blit_resolve_slices_for_hiz(struct ilo_context *ilo,
       assert(!(resolve_flags & (other_writers | any_reader)));
 
       if (!(resolve_flags & ILO_TEXTURE_CLEAR)) {
+         const uint32_t first_clear_value = ilo_texture_get_slice(tex,
+               level, first_slice)->clear_value;
          bool set_clear_value = false;
-         uint32_t first_clear_value;
 
          for (i = 0; i < num_slices; i++) {
             const struct ilo_texture_slice *slice =
@@ -200,12 +201,8 @@ ilo_blit_resolve_slices_for_hiz(struct ilo_context *ilo,
             if (slice->flags & other_writers) {
                ilo_blitter_rectlist_resolve_hiz(ilo->blitter,
                      res, level, first_slice + i);
-            }
-            else if (i == 0) {
-               first_clear_value = slice->clear_value;
-            }
-            else if (slice->clear_value != first_clear_value &&
-                     (slice->flags & ILO_TEXTURE_RENDER_WRITE)) {
+            } else if (slice->clear_value != first_clear_value &&
+                       (slice->flags & ILO_TEXTURE_RENDER_WRITE)) {
                ilo_blitter_rectlist_resolve_z(ilo->blitter,
                      res, level, first_slice + i);
                set_clear_value = true;
diff --git a/src/gallium/drivers/ilo/ilo_layout.c b/src/gallium/drivers/ilo/ilo_layout.c
index 73db796..881550b 100644
--- a/src/gallium/drivers/ilo/ilo_layout.c
+++ b/src/gallium/drivers/ilo/ilo_layout.c
@@ -656,7 +656,7 @@ layout_init_size_and_format(struct ilo_layout *layout,
 {
    const struct pipe_resource *templ = params->templ;
    enum pipe_format format = templ->format;
-   bool require_separate_stencil;
+   bool require_separate_stencil = false;
 
    layout->width0 = templ->width0;
    layout->height0 = templ->height0;
@@ -1101,6 +1101,11 @@ layout_calculate_hiz_size(struct ilo_layout *layout,
       }
       hz_height /= 2;
       break;
+   default:
+      assert(!"unknown HiZ walk");
+      hz_width = 0;
+      hz_height = 0;
+      break;
    }
 
    /*
diff --git a/src/gallium/drivers/ilo/ilo_layout.h b/src/gallium/drivers/ilo/ilo_layout.h
index 9aa2ae9..54ba2d8 100644
--- a/src/gallium/drivers/ilo/ilo_layout.h
+++ b/src/gallium/drivers/ilo/ilo_layout.h
@@ -282,6 +282,8 @@ ilo_layout_get_slice_pos(const struct ilo_layout *layout,
       }
    default:
       assert(!"unknown layout walk type");
+      *x = 0;
+      *y = 0;
       break;
    }
 




More information about the mesa-commit mailing list