[Mesa-dev] [PATCH] glsl: initialise const force glsl extension warning in fake ctx

Brian Paul brianp at vmware.com
Tue Mar 13 08:02:46 PDT 2012


On 03/13/2012 08:53 AM, Dave Airlie wrote:
> From: Dave Airlie<airlied at redhat.com>
>
> valgrind complained about an uninitialised value being used in
> glsl_parser_extras.cpp, and this was the one it was giving out about.
>
> Just initialise the value in the fakectx.
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
> ---
>   src/glsl/builtins/tools/generate_builtins.py |    1 +
>   1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
> index 72d12bb..bd15c4d 100755
> --- a/src/glsl/builtins/tools/generate_builtins.py
> +++ b/src/glsl/builtins/tools/generate_builtins.py
> @@ -156,6 +156,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
>      fakeCtx.API = API_OPENGL;
>      fakeCtx.Const.GLSLVersion = 130;
>      fakeCtx.Extensions.ARB_ES2_compatibility = true;
> +   fakeCtx.Const.ForceGLSLExtensionsWarn = false;
>      gl_shader *sh = _mesa_new_shader(NULL, 0, target);
>      struct _mesa_glsl_parse_state *st =
>         new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);

It might be better to do memset(&fakeCtx, 0, sizeof(fakeCtx)) to be 
safer and more future-proof.

-Brian


More information about the mesa-dev mailing list