[Mesa-dev] [PATCH v2] glsl: Enable debug prints for do_common_optimization
Jordan Justen
jordan.l.justen at intel.com
Sun Jan 24 01:34:03 PST 2016
On 2016-01-23 11:06:48, Kenneth Graunke wrote:
> On Thursday, January 21, 2016 11:35:31 PM PST Jordan Justen wrote:
> > Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> > ---
> >
> > I tested a release build. I think v1 produced comparable code to
> > before the patch, but it was a bit larger. I found that this v2 code
> > would produce identical code to our current code for release builds.
> >
> > Timothy, should I add your r-b for v2?
> >
> > src/glsl/glsl_parser_extras.cpp | 81 ++++++++++++++++++++++++
> +----------------
> > 1 file changed, 49 insertions(+), 32 deletions(-)
> >
> > diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/
> glsl_parser_extras.cpp
> > index 1d74db5..1c1bf78 100644
> > --- a/src/glsl/glsl_parser_extras.cpp
> > +++ b/src/glsl/glsl_parser_extras.cpp
> > @@ -1864,59 +1864,76 @@ do_common_optimization(exec_list *ir, bool linked,
> > const struct gl_shader_compiler_options *options,
> > bool native_integers)
> > {
> > + const bool debug = false;
> > GLboolean progress = GL_FALSE;
> >
> > - progress = lower_instructions(ir, SUB_TO_ADD_NEG) || progress;
> > +#define OPT(PASS, ...) do { \
> > + if (debug) { \
> > + printf("START GLSL optimization %s\n", #PASS); \
>
> Can we use stderr rather than stdout? Most of our debugging messages
> go there already, and if we use both, things just get jumbled.
>
> fprintf(stderr, ...
>
> > + const bool opt_progress = PASS(__VA_ARGS__); \
> > + progress = opt_progress || progress; \
> > + if (opt_progress) \
> > + _mesa_print_ir(stdout, ir, NULL); \
>
> stderr
>
Ok. I'll fix that. Maybe I copied it from opt_array_splitting.cpp?
> > + printf("GLSL optimization %s: %s progress\n", \
> > + #PASS, opt_progress ? "made" : "no"); \
>
> fprintf(stderr, ...
>
> Either way,
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Thanks!
-Jordan
More information about the mesa-dev
mailing list