Mesa (master): i965/fs: Localize variables' scopes.

Matt Turner mattst88 at kemper.freedesktop.org
Mon Oct 19 17:19:40 UTC 2015


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu Oct 15 16:01:11 2015 -0700

i965/fs: Localize variables' scopes.

---

 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 23c99b7..f825fed 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -904,12 +904,9 @@ fs_visitor::emit_urb_writes()
    urb_offset = 0;
    flush = false;
    for (slot = 0; slot < vue_map->num_slots; slot++) {
-      fs_reg reg, src, zero;
-
       int varying = vue_map->slot_to_varying[slot];
       switch (varying) {
-      case VARYING_SLOT_PSIZ:
-
+      case VARYING_SLOT_PSIZ: {
          /* The point size varying slot is the vue header and is always in the
           * vue map.  But often none of the special varyings that live there
           * are written and in that case we can skip writing to the vue
@@ -921,7 +918,7 @@ fs_visitor::emit_urb_writes()
             break;
          }
 
-         zero = fs_reg(GRF, alloc.allocate(1), BRW_REGISTER_TYPE_UD);
+         fs_reg zero(GRF, alloc.allocate(1), BRW_REGISTER_TYPE_UD);
          bld.MOV(zero, fs_reg(0u));
 
          sources[length++] = zero;
@@ -940,7 +937,7 @@ fs_visitor::emit_urb_writes()
          else
             sources[length++] = zero;
          break;
-
+      }
       case BRW_VARYING_SLOT_NDC:
       case VARYING_SLOT_EDGE:
          unreachable("unexpected scalar vs output");
@@ -973,8 +970,8 @@ fs_visitor::emit_urb_writes()
              * temp register and use that for the payload.
              */
             for (int i = 0; i < 4; i++) {
-               reg = fs_reg(GRF, alloc.allocate(1), outputs[varying].type);
-               src = offset(this->outputs[varying], bld, i);
+               fs_reg reg = fs_reg(GRF, alloc.allocate(1), outputs[varying].type);
+               fs_reg src = offset(this->outputs[varying], bld, i);
                set_saturate(true, bld.MOV(reg, src));
                sources[length++] = reg;
             }




More information about the mesa-commit mailing list