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

Anuj Phogat anuj.phogat at gmail.com
Thu Apr 16 16:19:06 PDT 2015


On Wed, Apr 15, 2015 at 2:24 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
>
> 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

1-2 are Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list