On Tuesday, December 01, 2015 07:40:54 PM Rob Clark wrote: > Simplify the instructions a bit by setting all the potentially needed > environment variables in run.c itself. > > Made very trivially more complex by the fact that all of the gallium > drivers are using u_debug stuff, so one env var contains potentially > multiple flags. We don't want to clobber any other flags that are set > so we simply append. > --- > README | 4 ++-- > run.c | 22 ++++++++++++++++++++-- > 2 files changed, 22 insertions(+), 4 deletions(-) > > diff --git a/README b/README > index 5477bf5..06294c9 100644 > --- a/README > +++ b/README > @@ -37,7 +37,7 @@ to run. > > === Running shaders === > > -ST_DEBUG=precompile R600_DEBUG=ps,vs,gs,precompile ./run shaders -1 2> > new-run > +./run shaders -1 2> new-run > > Note that a debug mesa build required (ie. --enable-debug) > > @@ -50,7 +50,7 @@ Note that a debug mesa build required (ie. --enable-debug) > > === Running shaders === > > -FD_MESA_DEBUG=shaderdb ST_DEBUG=precompile ./run -1 shaders 2> new-run > +./run -1 shaders 2> new-run > > Note that a debug mesa build required (ie. --enable-debug) > > diff --git a/run.c b/run.c > index 73e468d..82d8c91 100644 > --- a/run.c > +++ b/run.c > @@ -23,13 +23,15 @@ > * DEALINGS IN THE SOFTWARE. > */ > > +/* for memmem(). The man page doesn't say __USE_GNU... */ > +/* also for asprintf() */ > +#define _GNU_SOURCE > + > #include <time.h> > #include <stdio.h> > #include <fcntl.h> > #include <assert.h> > #include <signal.h> > -/* for memmem(). The man page doesn't say __USE_GNU... */ > -#define __USE_GNU > #include <string.h> > #include <stdlib.h> > #include <unistd.h> > @@ -292,6 +294,19 @@ void print_usage(const char *prog_name) > prog_name); > } > > +static void addenv(const char *name, const char *value) > +{ > + const char *orig = getenv(name); > + if (orig) { > + char *newval; > + asprintf(&newval, "%s,%s", orig, value); > + setenv(name, newval, 1); > + free(newval); > + } else { > + setenv(name, value, 1); > + } > +} > + > int > main(int argc, char **argv) > { > @@ -340,6 +355,9 @@ main(int argc, char **argv) > > setenv("allow_glsl_extension_directive_midshader", "true", 1); > setenv("shader_precompile", "true", 1); > + addenv("ST_DEBUG", "precompile"); > + addenv("R600_DEBUG", "ps,vs,gs,precompile"); > + addenv("FD_MESA_DEBUG", "shaderdb"); > > const char *client_extensions = eglQueryString(EGL_NO_DISPLAY, > EGL_EXTENSIONS); >
Thanks, Rob, this is definitely nicer :) Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev