[Mesa-dev] [PATCH 4/5] glcpp: Remove unused gl_api bits.

Kenneth Graunke kenneth at whitecape.org
Sat Jan 18 11:13:08 PST 2014


On 01/17/2014 09:09 PM, Matt Turner wrote:
> ---
>  src/glsl/glcpp/glcpp-parse.y | 1 -
>  src/glsl/glcpp/glcpp.c       | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
> index c774662..427fdec 100644
> --- a/src/glsl/glcpp/glcpp-parse.y
> +++ b/src/glsl/glcpp/glcpp-parse.y
> @@ -30,7 +30,6 @@
>  
>  #include "glcpp.h"
>  #include "main/core.h" /* for struct gl_extensions */
> -#include "main/mtypes.h" /* for gl_api enum */
>  
>  static void
>  yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error);
> diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c
> index 6994d7b..c9c2ff2 100644
> --- a/src/glsl/glcpp/glcpp.c
> +++ b/src/glsl/glcpp/glcpp.c
> @@ -101,7 +101,6 @@ load_text_file(void *ctx, const char *filename)
>  static void
>  init_fake_gl_context (struct gl_context *gl_ctx)
>  {
> -	gl_ctx->API = API_OPENGL_COMPAT;
>  	gl_ctx->Const.DisableGLSLLineContinuations = false;
>  }

NAK.  This is definitely used.

main allocates gl_ctx and calls init_fake_gl_context, which sets up
gl_ctx->API (without your patch).  It then does:

        ret = glcpp_preprocess(ctx, &shader, &info_log, NULL, &gl_ctx);

The first thing glcpp_preprocess does is:

        glcpp_parser_t *parser = glcpp_parser_create (extensions,
gl_ctx->API);

Then in glcpp_parser_create, we find:

        if (api == API_OPENGLES2) {
           parser->is_gles = true;
           add_builtin_define(parser, "GL_ES", 1);
           ...add ES extension defines...
        } else {
           ...add GL extension defines...
        }

With this patch, the behavior would likely be undefined.

--Ken


More information about the mesa-dev mailing list