[Mesa-dev] fixing GLSL NEW_IDENTIFIER error messages

Ilia Mirkin imirkin at alum.mit.edu
Wed Aug 5 15:59:27 PDT 2015


Not sure how much help this is, but

(gdb) p yyvsa[5]
$20 = {n = 7289280, real = 1.02144569e-38, dreal =
3.6013828309176816e-317, identifier = 0x6f39c0 "sampler2DMS",
type_qualifier = {

But how do you figure out that it's at 5? Don't know. yyval appears to
be yyvsa[4], so maybe *(&yyval+1)? Nope... doesn't seem to work.

On Wed, Aug 5, 2015 at 6:41 PM, Brian Paul <brianp at vmware.com> wrote:
>
> If a shader contains a declaration such as:
>
> uniform sampler2DMS tex;
>
> but it doesn't specify "#extension GL_ARB_texture_multisample: enable" we
> get a GLSL error saying something like "0:2(21): error: syntax error,
> unexpected NEW_IDENTIFIER, expecting '{'"
>
> There are other cases where the error "unexpected NEW_IDENTIFIER" pops up.
> In my experience it's often somewhere deep down inside a large shader.
>
> In this example, it would be nice if the compiler said "unexpected
> sampler2DMS identifier" instead of "unexpected NEW_IDENTIFIER".
>
> The error message comes directly from bison via the yyerror() function and I
> don't see an obvious way to get at the "sampler2DMS" string here.
>
> The YYLTYPE passed to yyerror() has useful info such as the identifier's
> line and location within the line:
>
> (gdb) p *loc
> $1 = {first_line = 10, first_column = 21, last_line = 10, last_column = 25,
> source = 0}
>
> but I don't see a way to get the actual string from the lexer.
>
> Anyone have some ideas?  Fixing this would be a nice time saver for me when
> I'm investigating application shader issues.
>
> -Brian
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list