Bug 39269

Summary: Pioneer Spacesim fails to compile shader
Product: Mesa Reporter: hadack
Component: glsl-compilerAssignee: Ian Romanick <idr>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium CC: stereotype441
Version: gitKeywords: NEEDINFO
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: output with MESA_GLSL=dump

Description hadack 2011-07-15 11:54:02 UTC
it disables shaders on start with this error message:

GL_ARB_point_sprite: Yes
Error compiling shader: data/shaders/postprocessBloom1Downsample.frag.glsl: 0:122(1): error: syntax error, unexpected EXTENSION, expecting $end

OpenGL vendor: X.Org R300 Project
OpenGL renderer string: Gallium 0.4 on ATI R580

Pioneer will run with shaders disabled.

this works with mesa 7.10 branch

the code to the game is here:
https://github.com/pioneerspacesim/pioneer

Distro is Slackware64 13.37
Comment 1 Ian Romanick 2011-07-15 15:14:45 UTC
(In reply to comment #0)
> it disables shaders on start with this error message:
> 
> GL_ARB_point_sprite: Yes
> Error compiling shader: data/shaders/postprocessBloom1Downsample.frag.glsl:
> 0:122(1): error: syntax error, unexpected EXTENSION, expecting $end

This concerns me a bit.  This is saying that the error is in line 122.  #extension lines can only be preceded in a shader by comments, whitespace, and the #version line.  The shader at github has #extension as the first line, so something fishy is going on.

Can you run with MESA_GLSL=dump and attach the output?

> OpenGL vendor: X.Org R300 Project
> OpenGL renderer string: Gallium 0.4 on ATI R580
> 
> Pioneer will run with shaders disabled.
> 
> this works with mesa 7.10 branch
> 
> the code to the game is here:
> https://github.com/pioneerspacesim/pioneer
> 
> Distro is Slackware64 13.37
Comment 2 hadack 2011-07-16 05:57:26 UTC
Created attachment 49176 [details]
output with MESA_GLSL=dump
Comment 3 Ian Romanick 2011-07-19 14:14:58 UTC
Just as I thought.  The #extension line is embedded in the middle of the shader test, and that is illegal in GLSL.

From page 12 (page 18 of the PDF) of the GLSL 1.10 spec (emphasis mine):

    "Each extension can define its allowed granularity of scope. If nothing
    is said, the granularity is a shader (that is, a single compilation
    unit), and the *extension directives must occur before any
    non-preprocessor tokens*."

Please report this bug to the Pioneer Spacesim developers.
Comment 4 Rob N 2011-07-23 14:03:35 UTC
I've just merged a patch to Pioneer git to fix this. Thanks for the guidance.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.