[Mesa-dev] [PATCH 21/23] i965: Print shader header in generate_assembly().

Matt Turner mattst88 at gmail.com
Mon May 19 11:55:47 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp    | 29 ++++++++++-------------
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp  | 17 ++++++-------
 src/mesa/drivers/dri/i965/gen8_fs_generator.cpp   | 29 ++++++++++-------------
 src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp | 17 ++++++-------
 4 files changed, 40 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 bae39c1..f70e7b2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1325,22 +1325,6 @@ void
 fs_generator::generate_code(exec_list *instructions, int *num_annotations,
                             struct annotation **annotation)
 {
-   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 block_num = 0;
    int ann_num = 0;
    int ann_size = 1024;
@@ -1850,6 +1834,19 @@ fs_generator::generate_assembly(exec_list *simd8_instructions,
                                   num_annotations, annotation);
 
          if (unlikely(debug_flag)) {
+            if (this->prog) {
+               fprintf(stderr,
+                       "Native code for %s fragment shader %d (SIMD%d dispatch):\n",
+                       this->prog->Label ? this->prog->Label : "unnamed",
+                       this->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);
+            }
             dump_assembly(p->store, num_annotations, annotation, brw, prog,
                           brw_disassemble);
             ralloc_free(annotation);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index 5980aad..819ed10 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -1264,16 +1264,6 @@ void
 vec4_generator::generate_code(exec_list *instructions, int *num_annotations,
                               struct annotation **annotation)
 {
-   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);
-      }
-   }
-
    int block_num = 0;
    int ann_num = 0;
    int ann_size = 1024;
@@ -1378,6 +1368,13 @@ vec4_generator::generate_assembly(exec_list *instructions,
    brw_compact_instructions(p, 0, num_annotations, annotation);
 
    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, num_annotations, annotation, brw, prog,
                     brw_disassemble);
       ralloc_free(annotation);
diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
index f498cd5..0ac00f9 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 @@ void
 gen8_fs_generator::generate_code(exec_list *instructions, int *num_annotations,
                                  struct annotation **annotation)
 {
-   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);
-      }
-   }
-
    int block_num = 0;
    int ann_num = 0;
    int ann_size = 1024;
@@ -1334,6 +1318,19 @@ gen8_fs_generator::generate_assembly(exec_list *simd8_instructions,
          generate_code(instructions[i], &num_annotations, &annotation);
 
          if (unlikely(INTEL_DEBUG & DEBUG_WM)) {
+            if (this->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",
+                       this->prog->Id, dispatch_width);
+            } else {
+               fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n",
+                       dispatch_width);
+            }
             dump_assembly(store, num_annotations, annotation, brw, prog,
                           gen8_disassemble);
             ralloc_free(annotation);
diff --git a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
index 4aeaf89..9f19a0a 100644
--- a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
@@ -846,16 +846,6 @@ gen8_vec4_generator::generate_code(exec_list *instructions,
                                    int *num_annotations,
                                    struct annotation **annotation)
 {
-   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);
-      }
-   }
-
    int block_num = 0;
    int ann_num = 0;
    int ann_size = 1024;
@@ -955,6 +945,13 @@ gen8_vec4_generator::generate_assembly(exec_list *instructions,
    generate_code(instructions, &num_annotations, &annotation);
 
    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, num_annotations, annotation, brw, prog,
                     gen8_disassemble);
       ralloc_free(annotation);
-- 
1.8.3.2



More information about the mesa-dev mailing list