[Mesa-dev] [PATCH 0/4] Clean up dFdy() bug fix.

Paul Berry stereotype441 at gmail.com
Wed Jul 18 12:16:04 PDT 2012

This patch series cleans up a bug fix I made to Mesa on June 22
(commit 82d2596: i965: Compute dFdy() correctly for FBOs).  The bug
was that the i965 driver wasn't adjusting the dFdy() logic to account
for the fact that window system framebuffers use flipped Y coordinates
compared to FBOs.  The fix was to compile fragment shaders differently
when they are used for FBOs vs window system framebuffers.

Commit 82d2596 conservatively assumed that all fragment shader
programs might use dFdy(), so it recompiled all of them when switching
between FBOs and window system framebuffers.  For shaders that don't
use dFdy(), the recompile is an unnecessary performance hit.  This
patch series adds accounting to core mesa to keep track of whether or
not a shader uses dFdy(), and changes the i965 back-end to only
recompile shaders that actually need it.

Patches 1-3 may be of interest to non-i965 developers, since the
accounting in core Mesa applies to all back-ends.

[PATCH 1/4] mesa: Add UsesDFdy to struct gl_fragment_program.
[PATCH 2/4] mesa: Set UsesDFdy appropriately for assembly programs.
[PATCH 3/4] glsl: Set UsesDFdy appropriately for GLSL shaders.
[PATCH 4/4] i965: Avoid unnecessary recompiles for shaders that don't use dFdy().

More information about the mesa-dev mailing list