GNOME Bugzilla – Bug 662542
The ARBfp and GLSL pipeline backends sometimes don't flush uniforms
Last modified: 2011-10-24 13:42:03 UTC
See the patch
Created attachment 199770 [details] [review] pipeline: Reset last_used_for_pipeline when the pipeline is destroyed Both the GLSL and the ARBfp pipeline backends were using a variable called last_used_for_pipeline to keep track of the last pipeline that the shader or program state was used for. If this address is the same as last time when the pipeline state is flushed then Cogl will only flush the uniforms that have been modified, otherwise it will flush all of them. The problem with this is that there was nothing to keep that address alive so it could be destroyed and reused for a different pipeline by the time the shader state is reused. This is quite likely to happen in an application using legacy state because in that case the shader state will always be used with a one-shot pipeline that will likely be recycled in the next frame. There is already a destroy callback to unref the shader state when the pipeline is destroyed so this patch just makes that callback also clear the last_used_for_pipeline pointer if it matches the pipeline being destroyed.
Pushed as 49e733fcd to master and 6ce87a0877726 on the cogl-1.8 branch.