[Mesa-dev] [PATCH 2/4] i965: Move program header printing to end of generate_code().

Matt Turner mattst88 at gmail.com
Mon Jun 2 11:06:03 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp    | 30 +++++++++++------------
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp  | 18 ++++++--------
 src/mesa/drivers/dri/i965/gen8_fs_generator.cpp   | 30 +++++++++++------------
 src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp | 18 ++++++--------
 4 files changed, 44 insertions(+), 52 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 19eb56e..55d9fca 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1324,22 +1324,6 @@ fs_generator::generate_untyped_surface_read(fs_inst *inst, struct brw_reg dst,
 void
 fs_generator::generate_code(exec_list *instructions)
 {
-   if (unlikely(debug_flag)) {
-      if (prog) {
-         fprintf(stderr,
-                 "Native code for %s fragment shader %d (SIMD%d dispatch):\n",
-                 prog->Label ? prog->Label : "unnamed",
-                 prog->Name, dispatch_width);
-      } else if (fp) {
-         fprintf(stderr,
-                 "Native code for fragment program %d (SIMD%d dispatch):\n",
-                 fp->Base.Id, dispatch_width);
-      } else {
-         fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n",
-                 dispatch_width);
-      }
-   }
-
    int start_offset = p->next_insn_offset;
 
    struct annotation_info annotation;
@@ -1779,6 +1763,20 @@ fs_generator::generate_code(exec_list *instructions)
                             annotation.ann);
 
    if (unlikely(debug_flag)) {
+      if (prog) {
+         fprintf(stderr,
+                 "Native code for %s fragment shader %d (SIMD%d dispatch):\n",
+                 prog->Label ? prog->Label : "unnamed",
+                 prog->Name, dispatch_width);
+      } else if (fp) {
+         fprintf(stderr,
+                 "Native code for fragment program %d (SIMD%d dispatch):\n",
+                 fp->Base.Id, dispatch_width);
+      } else {
+         fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n",
+                 dispatch_width);
+      }
+
       const struct gl_program *prog = fp ? &fp->Base : NULL;
 
       dump_assembly(p->store, annotation.ann_count, annotation.ann,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index 21c3c8a..2d0bea4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -1263,16 +1263,6 @@ vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,
 void
 vec4_generator::generate_code(exec_list *instructions)
 {
-   if (unlikely(debug_flag)) {
-      if (shader_prog) {
-         fprintf(stderr, "Native code for %s vertex shader %d:\n",
-                 shader_prog->Label ? shader_prog->Label : "unnamed",
-                 shader_prog->Name);
-      } else {
-         fprintf(stderr, "Native code for vertex program %d:\n", prog->Id);
-      }
-   }
-
    struct annotation_info annotation;
    memset(&annotation, 0, sizeof(annotation));
 
@@ -1323,6 +1313,14 @@ vec4_generator::generate_code(exec_list *instructions)
    brw_compact_instructions(p, 0, annotation.ann_count, annotation.ann);
 
    if (unlikely(debug_flag)) {
+      if (shader_prog) {
+         fprintf(stderr, "Native code for %s vertex shader %d:\n",
+                 shader_prog->Label ? shader_prog->Label : "unnamed",
+                 shader_prog->Name);
+      } else {
+         fprintf(stderr, "Native code for vertex program %d:\n", prog->Id);
+      }
+
       dump_assembly(p->store, annotation.ann_count, annotation.ann,
                     brw, prog, brw_disassemble);
       ralloc_free(annotation.ann);
diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
index 51ce4a7..3703368 100644
--- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
@@ -886,22 +886,6 @@ gen8_fs_generator::generate_untyped_surface_read(fs_inst *ir,
 void
 gen8_fs_generator::generate_code(exec_list *instructions)
 {
-   if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
-      if (prog) {
-         fprintf(stderr,
-                 "Native code for %s fragment shader %d (SIMD%d dispatch):\n",
-                shader_prog->Label ? shader_prog->Label : "unnamed",
-                shader_prog->Name, dispatch_width);
-      } else if (fp) {
-         fprintf(stderr,
-                 "Native code for fragment program %d (SIMD%d dispatch):\n",
-                 prog->Id, dispatch_width);
-      } else {
-         fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n",
-                 dispatch_width);
-      }
-   }
-
    struct annotation_info annotation;
    memset(&annotation, 0, sizeof(annotation));
 
@@ -1267,6 +1251,20 @@ gen8_fs_generator::generate_code(exec_list *instructions)
    annotation_finalize(&annotation, next_inst_offset);
 
    if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
+      if (prog) {
+         fprintf(stderr,
+                 "Native code for %s fragment shader %d (SIMD%d dispatch):\n",
+                shader_prog->Label ? shader_prog->Label : "unnamed",
+                shader_prog->Name, dispatch_width);
+      } else if (fp) {
+         fprintf(stderr,
+                 "Native code for fragment program %d (SIMD%d dispatch):\n",
+                 prog->Id, dispatch_width);
+      } else {
+         fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n",
+                 dispatch_width);
+      }
+
       dump_assembly(store, annotation.ann_count, annotation.ann, brw, prog,
                     gen8_disassemble);
       ralloc_free(annotation.ann);
diff --git a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
index 590c754..c319ed5 100644
--- a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
@@ -844,16 +844,6 @@ gen8_vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,
 void
 gen8_vec4_generator::generate_code(exec_list *instructions)
 {
-   if (unlikely(debug_flag)) {
-      if (shader_prog) {
-         fprintf(stderr, "Native code for %s vertex shader %d:\n",
-                 shader_prog->Label ? shader_prog->Label : "unnamed",
-                 shader_prog->Name);
-      } else {
-         fprintf(stderr, "Native code for vertex program %d:\n", prog->Id);
-      }
-   }
-
    struct annotation_info annotation;
    memset(&annotation, 0, sizeof(annotation));
 
@@ -897,6 +887,14 @@ gen8_vec4_generator::generate_code(exec_list *instructions)
    annotation_finalize(&annotation, next_inst_offset);
 
    if (unlikely(debug_flag)) {
+      if (shader_prog) {
+         fprintf(stderr, "Native code for %s vertex shader %d:\n",
+                 shader_prog->Label ? shader_prog->Label : "unnamed",
+                 shader_prog->Name);
+      } else {
+         fprintf(stderr, "Native code for vertex program %d:\n", prog->Id);
+      }
+
       dump_assembly(store, annotation.ann_count, annotation.ann,
                     brw, prog, gen8_disassemble);
       ralloc_free(annotation.ann);
-- 
1.8.3.2



More information about the mesa-dev mailing list