[Mesa-dev] Regression: Cogs continually recompiles the same shader

Kenneth Graunke kenneth at whitecape.org
Tue Nov 8 23:16:21 PST 2011


Ian,

I just tried running Cogs (from the Humble Indie Bundle 3) and 
discovered a terrible regression: it continually keeps recompiling 
fragment shader 19 over and over again.

It looks like it was caused by commit 71990969 ("mesa: Rewrite the way 
uniforms are tracked and handled").

Each time we try to use the shader, we look in the program cache, but 
fail every time, and resort to compiling it.  It turns out the 
brw_wm_prog_key is entirely identical *except* for a field called 
"program_string_id", which increases every time.

Apparently this is set by brwProgramStringNotify (brw_program.c:141), 
and is a monotonically increasing number that's supposed to uniquely 
identify a particular shader.

Commit 71990969 made _mesa_uniform() call ProgramStringNotify as part of 
"extra magic necessary" to propagate sampler changes to the driver. 
This causes the fragment program's ID to be set to a new/incremented 
value.  Which means we never find it in the cache again.

The code you replaced didn't call ProgramStringNotify, and Cogs seems to 
work equally well without it, so I'm not sure why it needs to be there.

(I must admit, I have no idea why this ID is useful nor what 
ProgramStringNotify actually does...)

Let me know if there's anything I can do to help.

--Kenneth


More information about the mesa-dev mailing list