[Mesa-dev] [PATCH 1/3] i965: Make shader_time use 0 instead of -1 for "no meaningful ID".

Kenneth Graunke kenneth at whitecape.org
Wed Apr 15 02:24:15 PDT 2015


0 is not a valid GLSL shader or ARB program ID.  For some reason,
shader_time used -1 instead...so we had code to detect 0, then override
it to -1.

We can just delete that.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_program.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 9e27c2a..0ca63de 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -346,7 +346,7 @@ print_shader_time_line(const char *stage, const char *name,
 {
    fprintf(stderr, "%-6s%-18s", stage, name);
 
-   if (shader_num != -1)
+   if (shader_num != 0)
       fprintf(stderr, "%4d: ", shader_num);
    else
       fprintf(stderr, "    : ");
@@ -443,7 +443,7 @@ brw_report_shader_time(struct brw_context *brw)
       if (scaled[i] == 0)
          continue;
 
-      int shader_num = -1;
+      int shader_num = 0;
       if (prog) {
          shader_num = prog->Name;
 
@@ -456,7 +456,6 @@ brw_report_shader_time(struct brw_context *brw)
              (brw->shader_time.types[i] == ST_FS8 ||
               brw->shader_time.types[i] == ST_FS16)) {
             shader_name = "ff";
-            shader_num = -1;
          } else {
             shader_name = "glsl";
          }
@@ -464,7 +463,6 @@ brw_report_shader_time(struct brw_context *brw)
          shader_num = brw->shader_time.programs[i]->Id;
          if (shader_num == 0) {
             shader_name = "ff";
-            shader_num = -1;
          } else {
             shader_name = "prog";
          }
@@ -495,10 +493,10 @@ brw_report_shader_time(struct brw_context *brw)
    }
 
    fprintf(stderr, "\n");
-   print_shader_time_line("total", "vs", -1, total_by_type[ST_VS], total);
-   print_shader_time_line("total", "gs", -1, total_by_type[ST_GS], total);
-   print_shader_time_line("total", "fs8", -1, total_by_type[ST_FS8], total);
-   print_shader_time_line("total", "fs16", -1, total_by_type[ST_FS16], total);
+   print_shader_time_line("total", "vs", 0, total_by_type[ST_VS], total);
+   print_shader_time_line("total", "gs", 0, total_by_type[ST_GS], total);
+   print_shader_time_line("total", "fs8", 0, total_by_type[ST_FS8], total);
+   print_shader_time_line("total", "fs16", 0, total_by_type[ST_FS16], total);
 }
 
 static void
-- 
2.3.5



More information about the mesa-dev mailing list