[Mesa-dev] [PATCH 7/9] i965: Avoid null access in fs_generator::generate_code()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Thu Jul 3 01:13:17 PDT 2014


Avoid null access while printing debug infos. On the same go
change local variable name to avoid confusion because there
already is class member with same name.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 52e88d4..6e201d1 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1783,9 +1783,13 @@ fs_generator::generate_code(exec_list *instructions)
               dispatch_width, before_size / 16, before_size, after_size,
               100.0f * (before_size - after_size) / before_size);
 
-      const struct gl_program *prog = fp ? &fp->Base : NULL;
+      const struct gl_program *fp_prog = fp ? &fp->Base : NULL;
+
+      if (fp_prog) {
+         dump_assembly(p->store, annotation.ann_count, annotation.ann, brw,
+                       fp_prog);
+      }
 
-      dump_assembly(p->store, annotation.ann_count, annotation.ann, brw, prog);
       ralloc_free(annotation.ann);
    }
 }
-- 
1.8.1.2



More information about the mesa-dev mailing list