1 /*
2  *  Copyright (C) 2005-2018 Team Kodi
3  *  This file is part of Kodi - https://kodi.tv
4  *
5  *  SPDX-License-Identifier: GPL-2.0-or-later
6  *  See LICENSES/README.md for more information.
7  */
8 
9 #include "RenderSystemGLES.h"
10 
11 #include "guilib/DirtyRegion.h"
12 #include "rendering/MatrixGL.h"
13 #include "settings/AdvancedSettings.h"
14 #include "settings/SettingsComponent.h"
15 #include "utils/GLUtils.h"
16 #include "utils/MathUtils.h"
17 #include "utils/SystemInfo.h"
18 #include "utils/TimeUtils.h"
19 #include "utils/XTimeUtils.h"
20 #include "utils/log.h"
21 #include "windowing/GraphicContext.h"
22 
23 #if defined(TARGET_LINUX)
24 #include "utils/EGLUtils.h"
25 #endif
26 
CRenderSystemGLES()27 CRenderSystemGLES::CRenderSystemGLES()
28  : CRenderSystemBase()
29 {
30 }
31 
InitRenderSystem()32 bool CRenderSystemGLES::InitRenderSystem()
33 {
34   GLint maxTextureSize;
35 
36   glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
37 
38   m_maxTextureSize = maxTextureSize;
39 
40   // Get the GLES version number
41   m_RenderVersionMajor = 0;
42   m_RenderVersionMinor = 0;
43 
44   const char* ver = (const char*)glGetString(GL_VERSION);
45   if (ver != 0)
46   {
47     sscanf(ver, "%d.%d", &m_RenderVersionMajor, &m_RenderVersionMinor);
48     if (!m_RenderVersionMajor)
49       sscanf(ver, "%*s %*s %d.%d", &m_RenderVersionMajor, &m_RenderVersionMinor);
50     m_RenderVersion = ver;
51   }
52 
53   // Get our driver vendor and renderer
54   const char *tmpVendor = (const char*) glGetString(GL_VENDOR);
55   m_RenderVendor.clear();
56   if (tmpVendor != NULL)
57     m_RenderVendor = tmpVendor;
58 
59   const char *tmpRenderer = (const char*) glGetString(GL_RENDERER);
60   m_RenderRenderer.clear();
61   if (tmpRenderer != NULL)
62     m_RenderRenderer = tmpRenderer;
63 
64   m_RenderExtensions  = " ";
65 
66   const char *tmpExtensions = (const char*) glGetString(GL_EXTENSIONS);
67   if (tmpExtensions != NULL)
68   {
69     m_RenderExtensions += tmpExtensions;
70   }
71 
72   m_RenderExtensions += " ";
73 
74 #if defined(GL_KHR_debug) && defined(TARGET_LINUX)
75   if (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_openGlDebugging)
76   {
77     if (IsExtSupported("GL_KHR_debug"))
78     {
79       auto glDebugMessageCallback = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECALLBACKKHRPROC>("glDebugMessageCallbackKHR");
80       auto glDebugMessageControl = CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECONTROLKHRPROC>("glDebugMessageControlKHR");
81 
82       glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR);
83       glDebugMessageCallback(KODI::UTILS::GL::GlErrorCallback, nullptr);
84 
85       // ignore shader compilation information
86       glDebugMessageControl(GL_DEBUG_SOURCE_SHADER_COMPILER_KHR, GL_DEBUG_TYPE_OTHER_KHR, GL_DONT_CARE, 0, nullptr, GL_FALSE);
87 
88       CLog::Log(LOGDEBUG, "OpenGL(ES): debugging enabled");
89     }
90     else
91     {
92       CLog::Log(LOGDEBUG, "OpenGL(ES): debugging requested but the required extension isn't available (GL_KHR_debug)");
93     }
94   }
95 #endif
96 
97   LogGraphicsInfo();
98 
99   m_bRenderCreated = true;
100 
101   InitialiseShaders();
102 
103   return true;
104 }
105 
ResetRenderSystem(int width,int height)106 bool CRenderSystemGLES::ResetRenderSystem(int width, int height)
107 {
108   m_width = width;
109   m_height = height;
110 
111   glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
112   CalculateMaxTexturesize();
113 
114   CRect rect( 0, 0, width, height );
115   SetViewPort( rect );
116 
117   glEnable(GL_SCISSOR_TEST);
118 
119   glMatrixProject.Clear();
120   glMatrixProject->LoadIdentity();
121   glMatrixProject->Ortho(0.0f, width-1, height-1, 0.0f, -1.0f, 1.0f);
122   glMatrixProject.Load();
123 
124   glMatrixModview.Clear();
125   glMatrixModview->LoadIdentity();
126   glMatrixModview.Load();
127 
128   glMatrixTexture.Clear();
129   glMatrixTexture->LoadIdentity();
130   glMatrixTexture.Load();
131 
132   glBlendFunc(GL_SRC_ALPHA, GL_ONE);
133   glEnable(GL_BLEND);          // Turn Blending On
134   glDisable(GL_DEPTH_TEST);
135 
136   return true;
137 }
138 
DestroyRenderSystem()139 bool CRenderSystemGLES::DestroyRenderSystem()
140 {
141   ResetScissors();
142   CDirtyRegionList dirtyRegions;
143   CDirtyRegion dirtyWindow(CServiceBroker::GetWinSystem()->GetGfxContext().GetViewWindow());
144   dirtyRegions.push_back(dirtyWindow);
145 
146   ClearBuffers(0);
147   glFinish();
148   PresentRenderImpl(true);
149 
150   ReleaseShaders();
151   m_bRenderCreated = false;
152 
153   return true;
154 }
155 
BeginRender()156 bool CRenderSystemGLES::BeginRender()
157 {
158   if (!m_bRenderCreated)
159     return false;
160 
161   bool useLimited = CServiceBroker::GetWinSystem()->UseLimitedColor();
162 
163   if (m_limitedColorRange != useLimited)
164   {
165     ReleaseShaders();
166     InitialiseShaders();
167   }
168 
169   m_limitedColorRange = useLimited;
170 
171   return true;
172 }
173 
EndRender()174 bool CRenderSystemGLES::EndRender()
175 {
176   if (!m_bRenderCreated)
177     return false;
178 
179   return true;
180 }
181 
ClearBuffers(UTILS::Color color)182 bool CRenderSystemGLES::ClearBuffers(UTILS::Color color)
183 {
184   if (!m_bRenderCreated)
185     return false;
186 
187   float r = GET_R(color) / 255.0f;
188   float g = GET_G(color) / 255.0f;
189   float b = GET_B(color) / 255.0f;
190   float a = GET_A(color) / 255.0f;
191 
192   glClearColor(r, g, b, a);
193 
194   GLbitfield flags = GL_COLOR_BUFFER_BIT;
195   glClear(flags);
196 
197   return true;
198 }
199 
IsExtSupported(const char * extension) const200 bool CRenderSystemGLES::IsExtSupported(const char* extension) const
201 {
202   if (strcmp( extension, "GL_EXT_framebuffer_object" ) == 0)
203   {
204     // GLES has FBO as a core element, not an extension!
205     return true;
206   }
207   else
208   {
209     std::string name;
210     name  = " ";
211     name += extension;
212     name += " ";
213 
214     return m_RenderExtensions.find(name) != std::string::npos;
215   }
216 }
217 
PresentRender(bool rendered,bool videoLayer)218 void CRenderSystemGLES::PresentRender(bool rendered, bool videoLayer)
219 {
220   SetVSync(true);
221 
222   if (!m_bRenderCreated)
223     return;
224 
225   PresentRenderImpl(rendered);
226 
227   // if video is rendered to a separate layer, we should not block this thread
228   if (!rendered && !videoLayer)
229     KODI::TIME::Sleep(40);
230 }
231 
SetVSync(bool enable)232 void CRenderSystemGLES::SetVSync(bool enable)
233 {
234   if (m_bVsyncInit)
235     return;
236 
237   if (!m_bRenderCreated)
238     return;
239 
240   if (enable)
241     CLog::Log(LOGINFO, "GLES: Enabling VSYNC");
242   else
243     CLog::Log(LOGINFO, "GLES: Disabling VSYNC");
244 
245   m_bVsyncInit = true;
246 
247   SetVSyncImpl(enable);
248 }
249 
CaptureStateBlock()250 void CRenderSystemGLES::CaptureStateBlock()
251 {
252   if (!m_bRenderCreated)
253     return;
254 
255   glMatrixProject.Push();
256   glMatrixModview.Push();
257   glMatrixTexture.Push();
258 
259   glDisable(GL_SCISSOR_TEST); // fixes FBO corruption on Macs
260   glActiveTexture(GL_TEXTURE0);
261 //! @todo - NOTE: Only for Screensavers & Visualisations
262 //  glColor3f(1.0, 1.0, 1.0);
263 }
264 
ApplyStateBlock()265 void CRenderSystemGLES::ApplyStateBlock()
266 {
267   if (!m_bRenderCreated)
268     return;
269 
270   glMatrixProject.PopLoad();
271   glMatrixModview.PopLoad();
272   glMatrixTexture.PopLoad();
273   glActiveTexture(GL_TEXTURE0);
274   glEnable(GL_BLEND);
275   glEnable(GL_SCISSOR_TEST);
276   glClear(GL_DEPTH_BUFFER_BIT);
277 }
278 
SetCameraPosition(const CPoint & camera,int screenWidth,int screenHeight,float stereoFactor)279 void CRenderSystemGLES::SetCameraPosition(const CPoint &camera, int screenWidth, int screenHeight, float stereoFactor)
280 {
281   if (!m_bRenderCreated)
282     return;
283 
284   CPoint offset = camera - CPoint(screenWidth*0.5f, screenHeight*0.5f);
285 
286   float w = (float)m_viewPort[2]*0.5f;
287   float h = (float)m_viewPort[3]*0.5f;
288 
289   glMatrixModview->LoadIdentity();
290   glMatrixModview->Translatef(-(w + offset.x - stereoFactor), +(h + offset.y), 0);
291   glMatrixModview->LookAt(0.0, 0.0, -2.0*h, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0);
292   glMatrixModview.Load();
293 
294   glMatrixProject->LoadIdentity();
295   glMatrixProject->Frustum( (-w - offset.x)*0.5f, (w - offset.x)*0.5f, (-h + offset.y)*0.5f, (h + offset.y)*0.5f, h, 100*h);
296   glMatrixProject.Load();
297 }
298 
Project(float & x,float & y,float & z)299 void CRenderSystemGLES::Project(float &x, float &y, float &z)
300 {
301   GLfloat coordX, coordY, coordZ;
302   if (CMatrixGL::Project(x, y, z, glMatrixModview.Get(), glMatrixProject.Get(), m_viewPort, &coordX, &coordY, &coordZ))
303   {
304     x = coordX;
305     y = (float)(m_viewPort[1] + m_viewPort[3] - coordY);
306     z = 0;
307   }
308 }
309 
CalculateMaxTexturesize()310 void CRenderSystemGLES::CalculateMaxTexturesize()
311 {
312   // GLES cannot do PROXY textures to determine maximum size,
313   CLog::Log(LOGINFO, "GLES: Maximum texture width: %u", m_maxTextureSize);
314 }
315 
GetViewPort(CRect & viewPort)316 void CRenderSystemGLES::GetViewPort(CRect& viewPort)
317 {
318   if (!m_bRenderCreated)
319     return;
320 
321   viewPort.x1 = m_viewPort[0];
322   viewPort.y1 = m_height - m_viewPort[1] - m_viewPort[3];
323   viewPort.x2 = m_viewPort[0] + m_viewPort[2];
324   viewPort.y2 = viewPort.y1 + m_viewPort[3];
325 }
326 
SetViewPort(const CRect & viewPort)327 void CRenderSystemGLES::SetViewPort(const CRect& viewPort)
328 {
329   if (!m_bRenderCreated)
330     return;
331 
332   glScissor((GLint) viewPort.x1, (GLint) (m_height - viewPort.y1 - viewPort.Height()), (GLsizei) viewPort.Width(), (GLsizei) viewPort.Height());
333   glViewport((GLint) viewPort.x1, (GLint) (m_height - viewPort.y1 - viewPort.Height()), (GLsizei) viewPort.Width(), (GLsizei) viewPort.Height());
334   m_viewPort[0] = viewPort.x1;
335   m_viewPort[1] = m_height - viewPort.y1 - viewPort.Height();
336   m_viewPort[2] = viewPort.Width();
337   m_viewPort[3] = viewPort.Height();
338 }
339 
ScissorsCanEffectClipping()340 bool CRenderSystemGLES::ScissorsCanEffectClipping()
341 {
342   if (m_pShader[m_method])
343     return m_pShader[m_method]->HardwareClipIsPossible();
344 
345   return false;
346 }
347 
ClipRectToScissorRect(const CRect & rect)348 CRect CRenderSystemGLES::ClipRectToScissorRect(const CRect &rect)
349 {
350   if (!m_pShader[m_method])
351     return CRect();
352   float xFactor = m_pShader[m_method]->GetClipXFactor();
353   float xOffset = m_pShader[m_method]->GetClipXOffset();
354   float yFactor = m_pShader[m_method]->GetClipYFactor();
355   float yOffset = m_pShader[m_method]->GetClipYOffset();
356   return CRect(rect.x1 * xFactor + xOffset,
357                rect.y1 * yFactor + yOffset,
358                rect.x2 * xFactor + xOffset,
359                rect.y2 * yFactor + yOffset);
360 }
361 
SetScissors(const CRect & rect)362 void CRenderSystemGLES::SetScissors(const CRect &rect)
363 {
364   if (!m_bRenderCreated)
365     return;
366   GLint x1 = MathUtils::round_int(rect.x1);
367   GLint y1 = MathUtils::round_int(rect.y1);
368   GLint x2 = MathUtils::round_int(rect.x2);
369   GLint y2 = MathUtils::round_int(rect.y2);
370   glScissor(x1, m_height - y2, x2-x1, y2-y1);
371 }
372 
ResetScissors()373 void CRenderSystemGLES::ResetScissors()
374 {
375   SetScissors(CRect(0, 0, (float)m_width, (float)m_height));
376 }
377 
InitialiseShaders()378 void CRenderSystemGLES::InitialiseShaders()
379 {
380   std::string defines;
381   m_limitedColorRange = CServiceBroker::GetWinSystem()->UseLimitedColor();
382   if (m_limitedColorRange)
383   {
384     defines += "#define KODI_LIMITED_RANGE 1\n";
385   }
386 
387   m_pShader[SM_DEFAULT].reset(new CGLESShader("gles_shader.vert", "gles_shader_default.frag", defines));
388   if (!m_pShader[SM_DEFAULT]->CompileAndLink())
389   {
390     m_pShader[SM_DEFAULT]->Free();
391     m_pShader[SM_DEFAULT].reset();
392     CLog::Log(LOGERROR, "GUI Shader gles_shader_default.frag - compile and link failed");
393   }
394 
395   m_pShader[SM_TEXTURE].reset(new CGLESShader("gles_shader_texture.frag", defines));
396   if (!m_pShader[SM_TEXTURE]->CompileAndLink())
397   {
398     m_pShader[SM_TEXTURE]->Free();
399     m_pShader[SM_TEXTURE].reset();
400     CLog::Log(LOGERROR, "GUI Shader gles_shader_texture.frag - compile and link failed");
401   }
402 
403   m_pShader[SM_MULTI].reset(new CGLESShader("gles_shader_multi.frag", defines));
404   if (!m_pShader[SM_MULTI]->CompileAndLink())
405   {
406     m_pShader[SM_MULTI]->Free();
407     m_pShader[SM_MULTI].reset();
408     CLog::Log(LOGERROR, "GUI Shader gles_shader_multi.frag - compile and link failed");
409   }
410 
411   m_pShader[SM_FONTS].reset(new CGLESShader("gles_shader_fonts.frag", defines));
412   if (!m_pShader[SM_FONTS]->CompileAndLink())
413   {
414     m_pShader[SM_FONTS]->Free();
415     m_pShader[SM_FONTS].reset();
416     CLog::Log(LOGERROR, "GUI Shader gles_shader_fonts.frag - compile and link failed");
417   }
418 
419   m_pShader[SM_TEXTURE_NOBLEND].reset(new CGLESShader("gles_shader_texture_noblend.frag", defines));
420   if (!m_pShader[SM_TEXTURE_NOBLEND]->CompileAndLink())
421   {
422     m_pShader[SM_TEXTURE_NOBLEND]->Free();
423     m_pShader[SM_TEXTURE_NOBLEND].reset();
424     CLog::Log(LOGERROR, "GUI Shader gles_shader_texture_noblend.frag - compile and link failed");
425   }
426 
427   m_pShader[SM_MULTI_BLENDCOLOR].reset(new CGLESShader("gles_shader_multi_blendcolor.frag", defines));
428   if (!m_pShader[SM_MULTI_BLENDCOLOR]->CompileAndLink())
429   {
430     m_pShader[SM_MULTI_BLENDCOLOR]->Free();
431     m_pShader[SM_MULTI_BLENDCOLOR].reset();
432     CLog::Log(LOGERROR, "GUI Shader gles_shader_multi_blendcolor.frag - compile and link failed");
433   }
434 
435   m_pShader[SM_TEXTURE_RGBA].reset(new CGLESShader("gles_shader_rgba.frag", defines));
436   if (!m_pShader[SM_TEXTURE_RGBA]->CompileAndLink())
437   {
438     m_pShader[SM_TEXTURE_RGBA]->Free();
439     m_pShader[SM_TEXTURE_RGBA].reset();
440     CLog::Log(LOGERROR, "GUI Shader gles_shader_rgba.frag - compile and link failed");
441   }
442 
443   m_pShader[SM_TEXTURE_RGBA_BLENDCOLOR].reset(new CGLESShader("gles_shader_rgba_blendcolor.frag", defines));
444   if (!m_pShader[SM_TEXTURE_RGBA_BLENDCOLOR]->CompileAndLink())
445   {
446     m_pShader[SM_TEXTURE_RGBA_BLENDCOLOR]->Free();
447     m_pShader[SM_TEXTURE_RGBA_BLENDCOLOR].reset();
448     CLog::Log(LOGERROR, "GUI Shader gles_shader_rgba_blendcolor.frag - compile and link failed");
449   }
450 
451   m_pShader[SM_TEXTURE_RGBA_BOB].reset(new CGLESShader("gles_shader_rgba_bob.frag", defines));
452   if (!m_pShader[SM_TEXTURE_RGBA_BOB]->CompileAndLink())
453   {
454     m_pShader[SM_TEXTURE_RGBA_BOB]->Free();
455     m_pShader[SM_TEXTURE_RGBA_BOB].reset();
456     CLog::Log(LOGERROR, "GUI Shader gles_shader_rgba_bob.frag - compile and link failed");
457   }
458 
459   if (IsExtSupported("GL_OES_EGL_image_external"))
460   {
461     m_pShader[SM_TEXTURE_RGBA_OES].reset(new CGLESShader("gles_shader_rgba_oes.frag", defines));
462     if (!m_pShader[SM_TEXTURE_RGBA_OES]->CompileAndLink())
463     {
464       m_pShader[SM_TEXTURE_RGBA_OES]->Free();
465       m_pShader[SM_TEXTURE_RGBA_OES].reset();
466       CLog::Log(LOGERROR, "GUI Shader gles_shader_rgba_oes.frag - compile and link failed");
467     }
468 
469 
470     m_pShader[SM_TEXTURE_RGBA_BOB_OES].reset(new CGLESShader("gles_shader_rgba_bob_oes.frag", defines));
471     if (!m_pShader[SM_TEXTURE_RGBA_BOB_OES]->CompileAndLink())
472     {
473       m_pShader[SM_TEXTURE_RGBA_BOB_OES]->Free();
474       m_pShader[SM_TEXTURE_RGBA_BOB_OES].reset();
475       CLog::Log(LOGERROR, "GUI Shader gles_shader_rgba_bob_oes.frag - compile and link failed");
476     }
477   }
478 
479   m_pShader[SM_TEXTURE_NOALPHA].reset(new CGLESShader("gles_shader_texture_noalpha.frag", defines));
480   if (!m_pShader[SM_TEXTURE_NOALPHA]->CompileAndLink())
481   {
482     m_pShader[SM_TEXTURE_NOALPHA]->Free();
483     m_pShader[SM_TEXTURE_NOALPHA].reset();
484     CLog::Log(LOGERROR, "GUI Shader gles_shader_texture_noalpha.frag - compile and link failed");
485   }
486 }
487 
ReleaseShaders()488 void CRenderSystemGLES::ReleaseShaders()
489 {
490   if (m_pShader[SM_DEFAULT])
491     m_pShader[SM_DEFAULT]->Free();
492   m_pShader[SM_DEFAULT].reset();
493 
494   if (m_pShader[SM_TEXTURE])
495     m_pShader[SM_TEXTURE]->Free();
496   m_pShader[SM_TEXTURE].reset();
497 
498   if (m_pShader[SM_MULTI])
499     m_pShader[SM_MULTI]->Free();
500   m_pShader[SM_MULTI].reset();
501 
502   if (m_pShader[SM_FONTS])
503     m_pShader[SM_FONTS]->Free();
504   m_pShader[SM_FONTS].reset();
505 
506   if (m_pShader[SM_TEXTURE_NOBLEND])
507     m_pShader[SM_TEXTURE_NOBLEND]->Free();
508   m_pShader[SM_TEXTURE_NOBLEND].reset();
509 
510   if (m_pShader[SM_MULTI_BLENDCOLOR])
511     m_pShader[SM_MULTI_BLENDCOLOR]->Free();
512   m_pShader[SM_MULTI_BLENDCOLOR].reset();
513 
514   if (m_pShader[SM_TEXTURE_RGBA])
515     m_pShader[SM_TEXTURE_RGBA]->Free();
516   m_pShader[SM_TEXTURE_RGBA].reset();
517 
518   if (m_pShader[SM_TEXTURE_RGBA_BLENDCOLOR])
519     m_pShader[SM_TEXTURE_RGBA_BLENDCOLOR]->Free();
520   m_pShader[SM_TEXTURE_RGBA_BLENDCOLOR].reset();
521 
522   if (m_pShader[SM_TEXTURE_RGBA_BOB])
523     m_pShader[SM_TEXTURE_RGBA_BOB]->Free();
524   m_pShader[SM_TEXTURE_RGBA_BOB].reset();
525 
526   if (m_pShader[SM_TEXTURE_RGBA_OES])
527     m_pShader[SM_TEXTURE_RGBA_OES]->Free();
528   m_pShader[SM_TEXTURE_RGBA_OES].reset();
529 
530   if (m_pShader[SM_TEXTURE_RGBA_BOB_OES])
531     m_pShader[SM_TEXTURE_RGBA_BOB_OES]->Free();
532   m_pShader[SM_TEXTURE_RGBA_BOB_OES].reset();
533 
534   if (m_pShader[SM_TEXTURE_NOALPHA])
535     m_pShader[SM_TEXTURE_NOALPHA]->Free();
536   m_pShader[SM_TEXTURE_NOALPHA].reset();
537 }
538 
EnableGUIShader(ESHADERMETHOD method)539 void CRenderSystemGLES::EnableGUIShader(ESHADERMETHOD method)
540 {
541   m_method = method;
542   if (m_pShader[m_method])
543   {
544     m_pShader[m_method]->Enable();
545   }
546   else
547   {
548     CLog::Log(LOGERROR, "Invalid GUI Shader selected - %d", method);
549   }
550 }
551 
DisableGUIShader()552 void CRenderSystemGLES::DisableGUIShader()
553 {
554   if (m_pShader[m_method])
555   {
556     m_pShader[m_method]->Disable();
557   }
558   m_method = SM_DEFAULT;
559 }
560 
GUIShaderGetPos()561 GLint CRenderSystemGLES::GUIShaderGetPos()
562 {
563   if (m_pShader[m_method])
564     return m_pShader[m_method]->GetPosLoc();
565 
566   return -1;
567 }
568 
GUIShaderGetCol()569 GLint CRenderSystemGLES::GUIShaderGetCol()
570 {
571   if (m_pShader[m_method])
572     return m_pShader[m_method]->GetColLoc();
573 
574   return -1;
575 }
576 
GUIShaderGetCoord0()577 GLint CRenderSystemGLES::GUIShaderGetCoord0()
578 {
579   if (m_pShader[m_method])
580     return m_pShader[m_method]->GetCord0Loc();
581 
582   return -1;
583 }
584 
GUIShaderGetCoord1()585 GLint CRenderSystemGLES::GUIShaderGetCoord1()
586 {
587   if (m_pShader[m_method])
588     return m_pShader[m_method]->GetCord1Loc();
589 
590   return -1;
591 }
592 
GUIShaderGetUniCol()593 GLint CRenderSystemGLES::GUIShaderGetUniCol()
594 {
595   if (m_pShader[m_method])
596     return m_pShader[m_method]->GetUniColLoc();
597 
598   return -1;
599 }
600 
GUIShaderGetCoord0Matrix()601 GLint CRenderSystemGLES::GUIShaderGetCoord0Matrix()
602 {
603   if (m_pShader[m_method])
604     return m_pShader[m_method]->GetCoord0MatrixLoc();
605 
606   return -1;
607 }
608 
GUIShaderGetField()609 GLint CRenderSystemGLES::GUIShaderGetField()
610 {
611   if (m_pShader[m_method])
612     return m_pShader[m_method]->GetFieldLoc();
613 
614   return -1;
615 }
616 
GUIShaderGetStep()617 GLint CRenderSystemGLES::GUIShaderGetStep()
618 {
619   if (m_pShader[m_method])
620     return m_pShader[m_method]->GetStepLoc();
621 
622   return -1;
623 }
624 
GUIShaderGetContrast()625 GLint CRenderSystemGLES::GUIShaderGetContrast()
626 {
627   if (m_pShader[m_method])
628     return m_pShader[m_method]->GetContrastLoc();
629 
630   return -1;
631 }
632 
GUIShaderGetBrightness()633 GLint CRenderSystemGLES::GUIShaderGetBrightness()
634 {
635   if (m_pShader[m_method])
636     return m_pShader[m_method]->GetBrightnessLoc();
637 
638   return -1;
639 }
640 
SupportsStereo(RENDER_STEREO_MODE mode) const641 bool CRenderSystemGLES::SupportsStereo(RENDER_STEREO_MODE mode) const
642 {
643   return CRenderSystemBase::SupportsStereo(mode);
644 }
645 
GUIShaderGetModel()646 GLint CRenderSystemGLES::GUIShaderGetModel()
647 {
648   if (m_pShader[m_method])
649     return m_pShader[m_method]->GetModelLoc();
650 
651   return -1;
652 }
653