From 8919cd5f54d8911af5ec1ffc475e50d91fa8057e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 10 Jun 2014 17:09:20 +0200 Subject: [PATCH] [effects] Simplify supported check in blur and backgroundcontrast GLSL is always required nowadays on GL compositor. REVIEW: 118642 --- effects/backgroundcontrast/contrast.cpp | 2 +- effects/backgroundcontrast/contrastshader.cpp | 19 +------------------ effects/backgroundcontrast/contrastshader.h | 2 -- effects/blur/blur.cpp | 2 +- effects/blur/blurshader.cpp | 18 +----------------- effects/blur/blurshader.h | 2 -- 6 files changed, 4 insertions(+), 41 deletions(-) diff --git a/effects/backgroundcontrast/contrast.cpp b/effects/backgroundcontrast/contrast.cpp index 2a8243dfcf..30d20c42e3 100644 --- a/effects/backgroundcontrast/contrast.cpp +++ b/effects/backgroundcontrast/contrast.cpp @@ -174,7 +174,7 @@ bool ContrastEffect::enabledByDefault() bool ContrastEffect::supported() { - bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported() && ContrastShader::supported(); + bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported(); if (supported) { int maxTexSize; diff --git a/effects/backgroundcontrast/contrastshader.cpp b/effects/backgroundcontrast/contrastshader.cpp index 8d620db5c6..96c6f3ad1f 100644 --- a/effects/backgroundcontrast/contrastshader.cpp +++ b/effects/backgroundcontrast/contrastshader.cpp @@ -45,11 +45,7 @@ ContrastShader::~ContrastShader() ContrastShader *ContrastShader::create() { - if (ContrastShader::supported()) { - return new ContrastShader(); - } - - return NULL; + return new ContrastShader(); } void ContrastShader::reset() @@ -60,19 +56,6 @@ void ContrastShader::reset() setIsValid(false); } -bool ContrastShader::supported() -{ - if (!GLPlatform::instance()->supports(GLSL)) - return false; - - (void) glGetError(); // Clear the error state - - if (glGetError() != GL_NO_ERROR) - return false; - - return true; -} - void ContrastShader::setOpacity(float opacity) { m_opacity = opacity; diff --git a/effects/backgroundcontrast/contrastshader.h b/effects/backgroundcontrast/contrastshader.h index c36baed227..5c13758c96 100644 --- a/effects/backgroundcontrast/contrastshader.h +++ b/effects/backgroundcontrast/contrastshader.h @@ -50,8 +50,6 @@ public: void bind(); void unbind(); - static bool supported(); - void setOpacity(float opacity); float opacity() const; diff --git a/effects/blur/blur.cpp b/effects/blur/blur.cpp index 90aa450a88..0663ace0de 100644 --- a/effects/blur/blur.cpp +++ b/effects/blur/blur.cpp @@ -154,7 +154,7 @@ bool BlurEffect::enabledByDefault() bool BlurEffect::supported() { - bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported() && GLSLBlurShader::supported(); + bool supported = effects->isOpenGLCompositing() && GLRenderTarget::supported() && GLTexture::NPOTTextureSupported(); if (supported) { int maxTexSize; diff --git a/effects/blur/blurshader.cpp b/effects/blur/blurshader.cpp index 8886ed827a..a7da1a7d2a 100644 --- a/effects/blur/blurshader.cpp +++ b/effects/blur/blurshader.cpp @@ -43,10 +43,7 @@ BlurShader::~BlurShader() BlurShader *BlurShader::create() { - if (GLSLBlurShader::supported()) - return new GLSLBlurShader(); - - return nullptr; + return new GLSLBlurShader(); } void BlurShader::setRadius(int radius) @@ -131,19 +128,6 @@ void GLSLBlurShader::reset() setIsValid(false); } -bool GLSLBlurShader::supported() -{ - if (!GLPlatform::instance()->supports(GLSL)) - return false; - - (void) glGetError(); // Clear the error state - - if (glGetError() != GL_NO_ERROR) - return false; - - return true; -} - void GLSLBlurShader::setPixelDistance(float val) { if (!isValid()) diff --git a/effects/blur/blurshader.h b/effects/blur/blurshader.h index b1769be7a8..49e9c0b862 100644 --- a/effects/blur/blurshader.h +++ b/effects/blur/blurshader.h @@ -102,8 +102,6 @@ public: void setTextureMatrix(const QMatrix4x4 &matrix); void setModelViewProjectionMatrix(const QMatrix4x4 &matrix); - static bool supported(); - protected: void init(); void reset();