diff options
author | bobo1on1 <bob-nospam-@xbmc.org> | 2011-01-05 23:38:12 +0100 |
---|---|---|
committer | bobo1on1 <bob-nospam-@xbmc.org> | 2011-01-06 16:17:54 +0100 |
commit | a73842d9aa9eacb2881f5546c5b9aaa80c696648 (patch) | |
tree | 10d2e1eaf8794961aac9e07baf3b40c279700e40 | |
parent | 2f4e6f409a33d9b11c80ab2c9d65fe63814847d6 (diff) |
fixed: nearest neighbor scaling on VDPAU and VAAPI
-rw-r--r-- | xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 37 | ||||
-rw-r--r-- | xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h | 5 |
2 files changed, 30 insertions, 12 deletions
diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp index 8894f309e2..7f8a364657 100644 --- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp +++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp @@ -1330,7 +1330,11 @@ void CLinuxRendererGL::RenderMultiPass(int index, int field) if (m_pVideoFilterShader) { - m_fbo.SetFiltering(GL_TEXTURE_2D, m_pVideoFilterShader->GetTextureFilter()); + GLint filter; + if (!m_pVideoFilterShader->GetTextureFilter(filter)) + filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + + m_fbo.SetFiltering(GL_TEXTURE_2D, filter); m_pVideoFilterShader->SetSourceTexture(0); m_pVideoFilterShader->SetWidth(m_sourceWidth); m_pVideoFilterShader->SetHeight(m_sourceHeight); @@ -1345,7 +1349,10 @@ void CLinuxRendererGL::RenderMultiPass(int index, int field) m_pVideoFilterShader->Enable(); } else - m_fbo.SetFiltering(GL_TEXTURE_2D, GL_LINEAR); + { + GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + m_fbo.SetFiltering(GL_TEXTURE_2D, filter); + } VerifyGLState(); @@ -1400,8 +1407,12 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) if (m_pVideoFilterShader) { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, m_pVideoFilterShader->GetTextureFilter()); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, m_pVideoFilterShader->GetTextureFilter()); + GLint filter; + if (!m_pVideoFilterShader->GetTextureFilter(filter)) + filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); m_pVideoFilterShader->SetSourceTexture(0); m_pVideoFilterShader->SetWidth(m_sourceWidth); m_pVideoFilterShader->SetHeight(m_sourceHeight); @@ -1417,8 +1428,9 @@ void CLinuxRendererGL::RenderVDPAU(int index, int field) } else { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); } glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -1486,8 +1498,12 @@ void CLinuxRendererGL::RenderVAAPI(int index, int field) if (m_pVideoFilterShader) { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, m_pVideoFilterShader->GetTextureFilter()); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, m_pVideoFilterShader->GetTextureFilter()); + GLint filter; + if (!m_pVideoFilterShader->GetTextureFilter(filter)) + filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); m_pVideoFilterShader->SetSourceTexture(0); m_pVideoFilterShader->SetWidth(m_sourceWidth); m_pVideoFilterShader->SetHeight(m_sourceHeight); @@ -1503,8 +1519,9 @@ void CLinuxRendererGL::RenderVAAPI(int index, int field) } else { - glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + GLint filter = m_scalingMethod == VS_SCALINGMETHOD_NEAREST ? GL_NEAREST : GL_LINEAR; + glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, filter); + glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, filter); } glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); diff --git a/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h b/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h index 2e990eb094..fc6a050633 100644 --- a/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h +++ b/xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h @@ -40,7 +40,7 @@ namespace Shaders { virtual void SetWidth(int w) { m_width = w; m_stepX = w>0?1.0f/w:0; } virtual void SetHeight(int h) { m_height = h; m_stepY = h>0?1.0f/h:0; } virtual void SetNonLinStretch(float stretch) { m_stretch = stretch; } - virtual GLint GetTextureFilter() { return GL_NEAREST; } + virtual bool GetTextureFilter(GLint& filter) { return false; } protected: int m_width; @@ -64,6 +64,8 @@ namespace Shaders { bool OnEnabled(); void Free(); + virtual bool GetTextureFilter(GLint& filter) { filter = GL_NEAREST; return true; } + protected: // kernel textures GLuint m_kernelTex1; @@ -82,7 +84,6 @@ namespace Shaders { StretchFilterShader(); void OnCompiledAndLinked(); bool OnEnabled(); - GLint GetTextureFilter() { return GL_LINEAR; } }; } // end namespace |