[Mesa-dev] [PATCH 2/2] glcpp: Resolve implicit GLSL version to 100 if the API is ES.

Matt Turner mattst88 at gmail.com
Sun Jan 26 20:44:28 PST 2014


On Sun, Jan 26, 2014 at 8:41 PM, Jordan Justen <jljusten at gmail.com> wrote:
> On Sun, Jan 26, 2014 at 6:14 PM, Matt Turner <mattst88 at gmail.com> wrote:
>> Fixes a regression since b2d1c579 where ES shaders without a #version
>> declaration would fail to compile if their precision declaration was
>> wrapped in the standard #ifdef GL_ES check.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73978
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74066
>> ---
>> I didn't realize that ES 1.00 shaders weren't required to specify a
>> version, so I missed handling this in b2d1c579.
>>
>>  src/glsl/glcpp/glcpp-parse.y | 16 +++++++++++++---
>>  src/glsl/glcpp/glcpp.c       |  1 +
>>  src/glsl/glcpp/glcpp.h       |  3 ++-
>>  src/glsl/glcpp/pp.c          |  2 +-
>>  4 files changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
>> index efcf139..57ffd49 100644
>> --- a/src/glsl/glcpp/glcpp-parse.y
>> +++ b/src/glsl/glcpp/glcpp-parse.y
>> @@ -30,6 +30,7 @@
>>
>>  #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);
>> @@ -1186,7 +1187,7 @@ static void add_builtin_define(glcpp_parser_t *parser,
>>  }
>>
>>  glcpp_parser_t *
>> -glcpp_parser_create (const struct gl_extensions *extensions)
>> +glcpp_parser_create (const struct gl_extensions *extensions, gl_api api)
>>  {
>>         glcpp_parser_t *parser;
>>
>> @@ -1215,6 +1216,7 @@ glcpp_parser_create (const struct gl_extensions *extensions)
>>         parser->error = 0;
>>
>>          parser->extensions = extensions;
>> +        parser->api = api;
>>          parser->version_resolved = false;
>>
>>         parser->has_new_line_number = 0;
>> @@ -2143,12 +2145,20 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
>>         }
>>  }
>>
>> -/* GLSL version is no version is explicitly specified. */
>> +/* GLSL version if no version is explicitly specified. */
>>  #define IMPLICIT_GLSL_VERSION 110
>>
>> +/* GLSL ES version if no version is explicitly specified. */
>> +#define IMPLICIT_GLSL_ES_VERSION 100
>> +
>>  void
>>  glcpp_parser_resolve_implicit_version(glcpp_parser_t *parser)
>>  {
>> -       _glcpp_parser_handle_version_declaration(parser, IMPLICIT_GLSL_VERSION,
>> +       int language_version = parser->api == API_OPENGLES2 ?
>
> api == API_OPENGLES?

No, ES 1.x doesn't have shaders.


More information about the mesa-dev mailing list