[Mesa-dev] [PATCH] mesa: fix GLES1 version initialization for gallium

Matt Turner mattst88 at gmail.com
Mon Jun 1 12:59:06 PDT 2015


On Mon, Jun 1, 2015 at 12:44 PM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> eglCreateContext was failing.
>
> Broken by 03fd6704db9f1d0f203bf8da18bd587c7e35ce60
> ---
>  src/mesa/main/version.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 409e5ae..572f2da 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -137,7 +137,7 @@ bool
>  _mesa_override_gl_version_contextless(struct gl_constants *consts,
>                                        gl_api *apiOut, GLuint *versionOut)
>  {
> -   int version;
> +   int version = 0;
>     bool fwd_context, compat_context;
>
>     get_gl_override(*apiOut, &version, &fwd_context, &compat_context);

The problem is that get_gl_override() doesn't initialize version,
fwd_context, or compat_context for GLES1 because it contains an
early-out:

   if (api == API_OPENGLES)
      return;

(and the compiler warns about it, and you can't *not* see it because
version.c gets recompiled nearly every time)

I guess your change is okay, since the rest of the function is inside
an if (version > 0), but I'm really not sure how Ian thought this was
supposed to work...


More information about the mesa-dev mailing list