[Mesa-dev] [PATCH 07/59] glsl/standalone: Add the ability to generate ir_builder code

Iago Toral itoral at igalia.com
Thu Oct 27 11:17:20 UTC 2016


Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

On Tue, 2016-10-25 at 17:59 -0700, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/compiler/glsl/main.cpp       |  1 +
>  src/compiler/glsl/standalone.cpp | 12 ++++++++++++
>  src/compiler/glsl/standalone.h   |  1 +
>  3 files changed, 14 insertions(+)
> 
> diff --git a/src/compiler/glsl/main.cpp b/src/compiler/glsl/main.cpp
> index 1e5e0fe..e0d3ab7 100644
> --- a/src/compiler/glsl/main.cpp
> +++ b/src/compiler/glsl/main.cpp
> @@ -42,6 +42,7 @@ const struct option compiler_opts[] = {
>     { "dump-ast", no_argument, &options.dump_ast, 1 },
>     { "dump-hir", no_argument, &options.dump_hir, 1 },
>     { "dump-lir", no_argument, &options.dump_lir, 1 },
> +   { "dump-builder", no_argument, &options.dump_builder, 1 },
>     { "link",     no_argument, &options.do_link,  1 },
>     { "just-log", no_argument, &options.just_log, 1 },
>     { "version",  required_argument, NULL, 'v' },
> diff --git a/src/compiler/glsl/standalone.cpp
> b/src/compiler/glsl/standalone.cpp
> index ecf162e..d5374ea 100644
> --- a/src/compiler/glsl/standalone.cpp
> +++ b/src/compiler/glsl/standalone.cpp
> @@ -40,6 +40,7 @@
>  #include "util/set.h"
>  #include "linker.h"
>  #include "glsl_parser_extras.h"
> +#include "ir_builder_print_visitor.h"
>  
>  class add_neg_to_sub_visitor : public ir_hierarchical_visitor {
>  public:
> @@ -578,6 +579,17 @@ standalone_compile_shader(const struct
> standalone_options *_options,
>           shader->Program = rzalloc(shader, gl_program);
>           init_gl_program(shader->Program, shader->Stage);
>        }
> +
> +      if (options->dump_builder) {
> +         for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
> +            struct gl_linked_shader *shader = whole_program-
> >_LinkedShaders[i];
> +
> +            if (!shader)
> +               continue;
> +
> +            _mesa_print_builder_for_ir(stdout, shader->ir);
> +         }
> +      }
>     }
>  
>     return whole_program;
> diff --git a/src/compiler/glsl/standalone.h
> b/src/compiler/glsl/standalone.h
> index 648cedb..5029e16 100644
> --- a/src/compiler/glsl/standalone.h
> +++ b/src/compiler/glsl/standalone.h
> @@ -33,6 +33,7 @@ struct standalone_options {
>     int dump_ast;
>     int dump_hir;
>     int dump_lir;
> +   int dump_builder;
>     int do_link;
>     int just_log;
>  };


More information about the mesa-dev mailing list