Bug 74092 - way to force glsl compiler to use specific glsl version? (e.g. for shaders with no #version)
Summary: way to force glsl compiler to use specific glsl version? (e.g. for shaders wi...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: All All
: medium enhancement
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-26 18:49 UTC by Christoph Haag
Modified: 2018-04-12 11:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Christoph Haag 2014-01-26 18:49:39 UTC
Unfortunately some developers still don't seem to read the specifications and write code that should not work.

For example if no #version is set in shaders, according to spec glsl version 1.10 is assumed. I would like a way to override that behavior.

There are already two variables related to that:
force_glsl_extensions_warn
MESA_GLSL_VERSION_OVERRIDE
but as far as I am aware the first doesn't help with syntax changes like arrays as out or inout parameters and the second does apparently not influence what the compiler will assume when no #version is set.

An example of a shader that can not be compiled with force_glsl_extensions_warn=true MESA_GLSL_VERSION_OVERRIDE=130 would be this one:

void a(inout vec4 b[1]) {}


Some time ago this was on the mailing list, but rejected because for several reason that was the wrong place and way to do it:
http://lists.freedesktop.org/archives/mesa-dev/2012-August/026022.html
Comment 1 Kenneth Graunke 2014-01-27 05:36:08 UTC
For Gallium drivers, there's a driconf option:

force_glsl_version=130

Does that not do what you want?  (It looks like i965 doesn't support it, but it probably ought to...)
Comment 2 Christoph Haag 2014-01-27 10:31:34 UTC
For gallium drivers it actually does what I want. But I did not find it with google (14 results...) and of course I neglected looking into driconf.

Could it be added to http://www.mesa3d.org/envvars.html? (it does seem to work as a variable with force_glsl_version=130)

If this was added to i965 I would be completely happy.

And if the compiler behaves differently for different drivers, would it be possible to make mesa/src/glsl/glsl_compiler work with DRI_PRIME too?
Comment 3 Timothy Arceri 2018-04-12 11:10:46 UTC
(In reply to Christoph Haag from comment #2)
> For gallium drivers it actually does what I want. But I did not find it with
> google (14 results...) and of course I neglected looking into driconf.
> 
> Could it be added to http://www.mesa3d.org/envvars.html? (it does seem to
> work as a variable with force_glsl_version=130)
> 
> If this was added to i965 I would be completely happy.
> 
> And if the compiler behaves differently for different drivers, would it be
> possible to make mesa/src/glsl/glsl_compiler work with DRI_PRIME too?

The release notes say this was added to i965 in 13.0.6 so closing.


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.