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

Alex Deucher alexdeucher at gmail.com
Wed Nov 9 07:38:05 PST 2011


On Wed, Nov 9, 2011 at 2:16 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> 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").

That patch also appears to cause memory corruption with lightsmark:
http://lists.freedesktop.org/archives/mesa-dev/2011-November/014256.html

Alex

>
> 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
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list