Bug 24553 - shader compilation times explode when using more () pairs
Summary: shader compilation times explode when using more () pairs
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 29044
  Show dependency treegraph
 
Reported: 2009-10-15 08:12 UTC by Lars S
Modified: 2010-08-17 09:09 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
perl script that compiles some shaders and measures compilation time (1.13 KB, application/octet-stream)
2009-10-15 08:12 UTC, Lars S
Details

Description Lars S 2009-10-15 08:12:42 UTC
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[0].x/y ... Output on my machine:

                           X+Y   0.0861s
                       (X)+(Y)   0.0981s
                       ((X)+Y)   0.1578s
                   ((X+((Y))))   0.5819s
                 (((X)+((Y))))   0.9528s

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.
Comment 1 Brian Paul 2009-10-15 08:25:58 UTC
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.

Comment 2 Eric Anholt 2010-08-17 09:09:49 UTC
glsl2 is merged, and parsing is nice and fast now.


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.