[Mesa-dev] [PATCH] i965/fs: Fix a couple of uninitialized value warnings

Jason Ekstrand jason at jlekstrand.net
Tue Sep 30 15:42:34 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 6ed3e95..7e4cb04 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2579,7 +2579,7 @@ fs_visitor::emit_repclear_shader()
                            fs_reg(UNIFORM, 0, BRW_REGISTER_TYPE_F)));
    mov->force_writemask_all = true;
 
-   fs_inst *write;
+   fs_inst *write = NULL;
    if (key->nr_color_regions == 1) {
       write = emit(FS_OPCODE_REP_FB_WRITE);
       write->saturate = key->clamp_fragment_color;
@@ -2588,6 +2588,7 @@ fs_visitor::emit_repclear_shader()
       write->header_present = false;
       write->mlen = 1;
    } else {
+      assert(key->nr_color_regions > 0);
       for (int i = 0; i < key->nr_color_regions; ++i) {
          write = emit(FS_OPCODE_REP_FB_WRITE);
          write->saturate = key->clamp_fragment_color;
@@ -2963,11 +2964,12 @@ fs_visitor::lower_load_payload()
    memset(metadata, 0, sizeof(metadata));
 
    foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
-      int dst_reg;
-      if (inst->dst.file == MRF) {
-         dst_reg = inst->dst.reg;
-      } else if (inst->dst.file == GRF) {
+      int dst_reg ;
+      } if (inst->dst.file == GRF) {
          dst_reg = vgrf_to_reg[inst->dst.reg];
+      } else {
+         /* MRF */
+         dst_reg = inst->dst.reg;
       }
 
       if (inst->dst.file == MRF || inst->dst.file == GRF) {
-- 
2.1.0



More information about the mesa-dev mailing list