From 778a7fd1a0f7ce89df9a8e1b35e8beb5461ab7bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 26 Nov 2015 09:36:54 +0100 Subject: [PATCH] [kwinglutils] Add a ShaderTraits variant to ShaderBinder Simplifies binding a Shader with traits. --- libkwineffects/kwinglutils.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h index 1124fd48d5..553e713cff 100644 --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -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() {