# Add support for generating shaders at runtime

Review Request #120280 - Created Sept. 22, 2014 and submitted - Latest diff uploaded

Information | |
---|---|

Fredrik HÃ¶glund | |

kwin | |

master | |

Reviewers | |

kwin | |

This makes kwin generate shaders on-demand that are optimized for the current rendering operation.

It is possible that this will break assumptions in some effects. For example I noticed that the cube effect relied on paintWindow() using the generic vertex shader without setting the shader in WindowPaintData.

The projection matrix used by the generated shaders is always a perspective matrix, since there is no performance advantage to using an orhtographic matrix. The perspective matrix produces the same result as the orthographic matrix when the Z-coordinate is zero. The matrix is now also set by paintWindow(), so effects can no longer change the matrix uniforms directly before they call paintWindow(). Instead I've added a projection and a model-view matrix in WindowPaintData.

This also fixes a long standing bug; when you activate the cube effect and a taskbar thumbnail is visible, the cube transformation is no longer applied to the thumbnail image.

This series is also available in the dynamic-shaders branch in my kwin clone.