[Mesa-dev] [PATCH] mesa: Only update sampler uniforms that are used by the shader stage
Kenneth Graunke
kenneth at whitecape.org
Mon Nov 14 18:12:31 PST 2011
On 11/14/2011 11:25 AM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Previously a vertex shader that used no samplers would get updated (by
> calling the driver's ProgramStringNotify) when a sampler in the
> fragment shader was updated. This was discovered while investigating
> some spurious code generation for shaders in Cogs. The behavior in
> Cogs is especially pessimal because it ping-pongs sampler uniform
> settings:
>
> glUniform1i(sampler1, 0);
> glUniform1i(sampler2, 1);
> draw();
> glUniform1i(sampler1, 1);
> glUniform1i(sampler2, 0);
> draw();
> glUniform1i(sampler1, 0);
> glUniform1i(sampler2, 1);
> draw();
> // etc.
>
> ProgramStringNotify is still too big of a hammer. Applications like
> Cogs will still defeat the shader cache. A lighter-weight mechanism
> that can work with the shader cache is needed. However, this patch at
> least restores the previous behavior.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
I could've sworn this was a regression and that I bisected it to your
patch...but apparently Cogs continually recompiles shaders even on 7.11.
Sorry, Ian. I honestly don't know how I managed to botch testing that
badly.
Still, this looks like a good patch that will probably help other cases.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list