diff options
author | Lukas Rusak <lorusak@gmail.com> | 2018-02-07 00:13:12 -0800 |
---|---|---|
committer | Lukas Rusak <lorusak@gmail.com> | 2018-02-08 14:12:53 -0800 |
commit | 2cc7a323d802f8b4a52134548f1406e7f7724e41 (patch) | |
tree | 76645a37b5c569b4cc75d603b9dae35c2a13c16e | |
parent | 21a2f2910329b7dabb75de8dc3aa7985bd8e5754 (diff) |
Retroplayer: pass shader method
4 files changed, 31 insertions, 7 deletions
diff --git a/xbmc/cores/RetroPlayer/rendering/RenderContext.cpp b/xbmc/cores/RetroPlayer/rendering/RenderContext.cpp index 2182639421..75ca181b40 100644 --- a/xbmc/cores/RetroPlayer/rendering/RenderContext.cpp +++ b/xbmc/cores/RetroPlayer/rendering/RenderContext.cpp @@ -70,16 +70,34 @@ void CRenderContext::ApplyStateBlock() m_rendering->ApplyStateBlock(); } -void CRenderContext::EnableGUIShader() +#if defined(HAS_GL) || defined(HAS_GLES) +namespace +{ +static ESHADERMETHOD TranslateShaderMethod(GL_SHADER_METHOD method) +{ + switch (method) + { + case GL_SHADER_METHOD::DEFAULT: return SM_DEFAULT; + case GL_SHADER_METHOD::TEXTURE: return SM_TEXTURE; + default: + break; + } + + return SM_DEFAULT; +} +} +#endif + +void CRenderContext::EnableGUIShader(GL_SHADER_METHOD method) { #if defined(HAS_GL) CRenderSystemGL *rendering = dynamic_cast<CRenderSystemGL*>(m_rendering); if (rendering != nullptr) - rendering->EnableShader(SM_TEXTURE); + rendering->EnableShader(TranslateShaderMethod(method)); #elif HAS_GLES >= 2 CRenderSystemGLES *renderingGLES = dynamic_cast<CRenderSystemGLES*>(m_rendering); if (renderingGLES != nullptr) - renderingGLES->EnableGUIShader(SM_TEXTURE); + renderingGLES->EnableGUIShader(TranslateShaderMethod(method)); #endif } diff --git a/xbmc/cores/RetroPlayer/rendering/RenderContext.h b/xbmc/cores/RetroPlayer/rendering/RenderContext.h index a04bf7c0ee..5befef8db0 100644 --- a/xbmc/cores/RetroPlayer/rendering/RenderContext.h +++ b/xbmc/cores/RetroPlayer/rendering/RenderContext.h @@ -33,6 +33,12 @@ class CRenderSystemBase; class CWinSystemBase; class TransformMatrix; +enum class GL_SHADER_METHOD +{ + DEFAULT, + TEXTURE, +}; + namespace KODI { namespace RETRO @@ -57,7 +63,7 @@ namespace RETRO void ApplyStateBlock(); // OpenGL(ES) rendering functions - void EnableGUIShader(); + void EnableGUIShader(GL_SHADER_METHOD method); void DisableGUIShader(); int GUIShaderGetPos(); int GUIShaderGetCoord0(); diff --git a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererGuiTexture.cpp b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererGuiTexture.cpp index d918237485..fa0799400d 100644 --- a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererGuiTexture.cpp +++ b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererGuiTexture.cpp @@ -145,7 +145,7 @@ void CRPRendererGuiTexture::RenderInternal(bool clear, uint8_t alpha) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - m_context.EnableGUIShader(); + m_context.EnableGUIShader(GL_SHADER_METHOD::TEXTURE); GLubyte colour[4]; GLubyte idx[4] = {0, 1, 3, 2}; // Determines order of the vertices @@ -236,7 +236,7 @@ void CRPRendererGuiTexture::RenderInternal(bool clear, uint8_t alpha) glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); // Turn blending On - m_context.EnableGUIShader(); + m_context.EnableGUIShader(GL_SHADER_METHOD::TEXTURE); GLubyte col[4]; GLfloat ver[4][3]; diff --git a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGLES.cpp b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGLES.cpp index 46ed8354c1..92e30e4fe7 100644 --- a/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGLES.cpp +++ b/xbmc/cores/RetroPlayer/rendering/VideoRenderers/RPRendererOpenGLES.cpp @@ -233,7 +233,7 @@ void CRPRendererOpenGLES::Render(uint8_t alpha) glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(m_textureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - m_context.EnableGUIShader(); + m_context.EnableGUIShader(GL_SHADER_METHOD::TEXTURE); GLubyte colour[4]; GLfloat ver[4][3]; |