Created attachment 30451 [details]
perl script that compiles some shaders and measures compilation time
When a shader program contains many (()) pairs, compiling (not running) the
shader becomes incredibly slow on MESA, for no apparent reason. The behaviour can
be observed on at least MESA 7.4 and 7.6 (Debian packages).
Attached is an example program that measures the time different shaders take to
compile. X and Y stand for gl_TexCoord.x/y ... Output on my machine:
I ran this in software rendering mode (tested with LIBGL_ALWAYS_SOFTWARE=1 and
with libgl1-mesa-swx11). I don't know about DRI modules because I have no machine
available that have MESA drivers supporting shaders (just machines using free
radeon drivers, which don't support shaders).
I am however able to say what happens on a Vista machine. The same program
produces compile times around 0.0004s there, for all textures. I also
successfully tested ((sin((X))*((cos(((Y)/((0.5)))))+0.2))/2.) there, which does
not seem to terminate in finite time with MESA.
Unfortunately, our home-grown GLSL parser is pretty slow. Longer term, we hope to rewrite the GLSL compiler to address this and many other issues. Ian Romanick has started a new compiler which uses lex/yacc for parsing and doesn't have this issue. We'll likely use that for the new compiler. This is a long-term project however, and it won't get fixed in the short-term. Sorry.
glsl2 is merged, and parsing is nice and fast now.
on Jun 25, 2016 at 21:17:09.
(provided by the Example extension).