| KWin
    | 
Manager for Shaders. More...
#include <glshadermanager.h>
| Public Member Functions | |
| ShaderManager () | |
| ~ShaderManager () | |
| GLShader * | shader (ShaderTraits traits) | 
| GLShader * | getBoundShader () const | 
| bool | isShaderBound () const | 
| GLShader * | pushShader (ShaderTraits traits) | 
| void | pushShader (GLShader *shader) | 
| void | popShader () | 
| std::unique_ptr< GLShader > | loadShaderFromCode (const QByteArray &vertexSource, const QByteArray &fragmentSource) | 
| std::unique_ptr< GLShader > | generateCustomShader (ShaderTraits traits, const QByteArray &vertexSource=QByteArray(), const QByteArray &fragmentSource=QByteArray()) | 
| std::unique_ptr< GLShader > | generateShaderFromFile (ShaderTraits traits, const QString &vertexFile=QString(), const QString &fragmentFile=QString()) | 
| Static Public Member Functions | |
| static ShaderManager * | instance () | 
| static void | cleanup () | 
Manager for Shaders.
This class provides some built-in shaders to be used by both compositing scene and effects. The ShaderManager provides methods to bind a built-in or a custom shader and keeps track of the shaders which have been bound. When a shader is unbound the previously bound shader will be rebound.
Definition at line 47 of file glshadermanager.h.
| 
 | explicit | 
Definition at line 38 of file glshadermanager.cpp.
| KWin::ShaderManager::~ShaderManager | ( | ) | 
Definition at line 42 of file glshadermanager.cpp.
| 
 | static | 
Definition at line 33 of file glshadermanager.cpp.
| std::unique_ptr< GLShader > KWin::ShaderManager::generateCustomShader | ( | ShaderTraits | traits, | 
| const QByteArray & | vertexSource = QByteArray(), | ||
| const QByteArray & | fragmentSource = QByteArray() ) | 
Creates a custom shader with the given traits and custom vertexSource and or fragmentSource. If the vertexSource is empty a vertex shader with the given traits is generated. If it is not empty the vertexSource is used as the source for the vertex shader.
The same applies for argument fragmentSource just for the fragment shader.
So if both vertesSource and fragmentSource are provided the traits are ignored. If neither are provided a new shader following the traits is generated.
| traits | The shader traits for generating the shader | 
| vertexSource | optional vertex shader source code to be used instead of shader traits | 
| fragmentSource | optional fragment shader source code to be used instead of shader traits | 
Definition at line 245 of file glshadermanager.cpp.
| std::unique_ptr< GLShader > KWin::ShaderManager::generateShaderFromFile | ( | ShaderTraits | traits, | 
| const QString & | vertexFile = QString(), | ||
| const QString & | fragmentFile = QString() ) | 
Creates a custom shader with the given traits and custom vertexFile and or fragmentFile.
If the vertexFile is empty a vertex shader with the given traits is generated. If it is not empty the vertexFile is used as the source for the vertex shader.
The same applies for argument fragmentFile just for the fragment shader.
So if both vertexFile and fragmentFile are provided the traits are ignored. If neither are provided a new shader following the traits is generated.
If a custom shader stage is provided and core profile is used, the final file path will be resolved by appending "_core" to the basename.
| traits | The shader traits for generating the shader | 
| vertexFile | optional vertex shader source code to be used instead of shader traits | 
| fragmentFile | optional fragment shader source code to be used instead of shader traits | 
Definition at line 287 of file glshadermanager.cpp.
| GLShader * KWin::ShaderManager::getBoundShader | ( | ) | const | 
null if no shader is bound. Definition at line 323 of file glshadermanager.cpp.
| 
 | static | 
Definition at line 25 of file glshadermanager.cpp.
| bool KWin::ShaderManager::isShaderBound | ( | ) | const | 
true if a shader is bound, false otherwise Definition at line 332 of file glshadermanager.cpp.
| std::unique_ptr< GLShader > KWin::ShaderManager::loadShaderFromCode | ( | const QByteArray & | vertexSource, | 
| const QByteArray & | fragmentSource ) | 
Creates a GLShader with the specified sources. The difference to GLShader is that it does not need to be loaded from files.
| vertexSource | The source code of the vertex shader | 
| fragmentSource | The source code of the fragment shader. | 
Definition at line 379 of file glshadermanager.cpp.
| void KWin::ShaderManager::popShader | ( | ) | 
Unbinds the currently bound shader and rebinds a previous stored shader. If there is no previous shader, no shader will be rebound. It is not safe to call this method if there is no bound shader.
Definition at line 353 of file glshadermanager.cpp.
| void KWin::ShaderManager::pushShader | ( | GLShader * | shader | ) | 
Binds the shader. To unbind the shader use popShader. A previous bound shader will be rebound. To bind a built-in shader use the more specific method. 
| shader | The shader to be bound | 
Definition at line 344 of file glshadermanager.cpp.
| GLShader * KWin::ShaderManager::pushShader | ( | ShaderTraits | traits | ) | 
Pushes the current shader onto the stack and binds a shader with the given traits.
Definition at line 337 of file glshadermanager.cpp.
| GLShader * KWin::ShaderManager::shader | ( | ShaderTraits | traits | ) | 
Returns a shader with the given traits, creating it if necessary.
Definition at line 314 of file glshadermanager.cpp.