[kwinglutils] Add a ShaderTraits variant to ShaderBinder

Simplifies binding a Shader with traits.
This commit is contained in:
Martin Gräßlin 2015-11-26 09:36:54 +01:00
parent fbd1122a15
commit 778a7fd1a0

View file

@ -443,6 +443,14 @@ public:
* @see ShaderManager::pushShader
**/
explicit ShaderBinder(GLShader *shader);
/**
* @brief Pushes the Shader with the given @p traits to the ShaderManager's stack.
*
* @param traits The traits describing the shader
* @see ShaderManager::pushShader
* @since 5.6
**/
explicit ShaderBinder(ShaderTraits traits);
~ShaderBinder();
/**
@ -468,6 +476,13 @@ ShaderBinder::ShaderBinder(GLShader *shader)
ShaderManager::instance()->pushShader(shader);
}
inline
ShaderBinder::ShaderBinder(ShaderTraits traits)
: m_shader(nullptr)
{
m_shader = ShaderManager::instance()->pushShader(traits);
}
inline
ShaderBinder::~ShaderBinder()
{