1 #ifndef __VIDEOFILTER_SHADER_H__
2 #define __VIDEOFILTER_SHADER_H__
5 * Copyright (C) 2007-2013 Team XBMC
8 * This Program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * This Program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with XBMC; see the file COPYING. If not, see
20 * <http://www.gnu.org/licenses/>.
26 #if defined(HAS_GL) || HAS_GLES == 2
27 #include "system_gl.h"
30 #include "guilib/Shader.h"
31 #include "settings/VideoSettings.h"
35 class BaseVideoFilterShader : public CGLSLShaderProgram
38 BaseVideoFilterShader();
39 void Free() { CGLSLShaderProgram::Free(); }
40 virtual void SetSourceTexture(GLint ytex) { m_sourceTexUnit = ytex; }
41 virtual void SetWidth(int w) { m_width = w; m_stepX = w>0?1.0f/w:0; }
42 virtual void SetHeight(int h) { m_height = h; m_stepY = h>0?1.0f/h:0; }
43 virtual void SetNonLinStretch(float stretch) { m_stretch = stretch; }
44 virtual bool GetTextureFilter(GLint& filter) { return false; }
52 GLint m_sourceTexUnit;
54 // shader attribute handles
60 class ConvolutionFilterShader : public BaseVideoFilterShader
63 ConvolutionFilterShader(ESCALINGMETHOD method, bool stretch);
64 void OnCompiledAndLinked();
68 virtual bool GetTextureFilter(GLint& filter) { filter = GL_NEAREST; return true; }
74 // shader handles to kernel textures
77 ESCALINGMETHOD m_method;
78 bool m_floattex; //if float textures are supported
79 GLint m_internalformat;
82 class StretchFilterShader : public BaseVideoFilterShader
85 StretchFilterShader();
86 void OnCompiledAndLinked();
94 #endif //__VIDEOFILTER_SHADER_H__