Add performance check logs
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / gl-implementation.h
1 #ifndef DALI_INTERNAL_GL_IMPLEMENTATION_H
2 #define DALI_INTERNAL_GL_IMPLEMENTATION_H
3
4 /*
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <GLES2/gl2.h>
23 #include <GLES2/gl2ext.h>
24 #include <dali/devel-api/threading/conditional-wait.h>
25 #include <dali/integration-api/gl-abstraction.h>
26 #include <dali/internal/graphics/common/egl-include.h>
27 #include <dali/public-api/common/vector-wrapper.h>
28 #include <cstdlib>
29 #include <cstring>
30 #include <memory>
31
32 // INTERNAL INCLUDES
33 #include <dali/devel-api/adaptor-framework/environment-variable.h>
34 #include <dali/internal/graphics/gles/gl-extensions-support.h>
35 #include <dali/internal/graphics/gles/gles-abstraction.h>
36 #include <dali/internal/graphics/gles/gles2-implementation.h>
37 #include <dali/internal/graphics/gles/gles3-implementation.h>
38 #include <dali/internal/system/common/time-service.h>
39
40 namespace Dali
41 {
42 namespace Internal
43 {
44 namespace Adaptor
45 {
46 namespace
47 {
48 static constexpr int32_t INITIAL_GLES_VERSION                         = 30;
49 static constexpr int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32;
50
51 static constexpr int32_t MINIMUM_GLES_VERSION_GET_MAXIMUM_MULTISAMPLES_TO_TEXTURE = 30;
52
53 static constexpr const char* LEGACY_SHADING_LANGUAGE_VERSION = "100";
54
55 static constexpr const char* DEFAULT_SAMPLER_TYPE = "sampler2D";
56
57 static constexpr const char* FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX =
58   "#ifdef GL_KHR_blend_equation_advanced\n"
59   "#extension GL_KHR_blend_equation_advanced : enable\n"
60   "#endif\n"
61
62   "#if defined(GL_KHR_blend_equation_advanced) || __VERSION__>=320\n"
63   "  layout(blend_support_all_equations) out;\n"
64   "#endif\n";
65
66 static constexpr const char* FRAGMENT_SHADER_OUTPUT_COLOR_STRING =
67   "out mediump vec4 fragColor;\n";
68
69 static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING = "#extension GL_OES_EGL_image_external:require\n";
70
71 static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3 = "#extension GL_OES_EGL_image_external_essl3:require\n";
72
73 // Threshold time in miliseconds
74 constexpr auto PERFORMANCE_LOG_THRESHOLD_TIME_ENV = "DALI_EGL_PERFORMANCE_LOG_THRESHOLD_TIME";
75
76 uint32_t GetPerformanceLogThresholdTime()
77 {
78   auto     timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(PERFORMANCE_LOG_THRESHOLD_TIME_ENV);
79   uint32_t time       = timeString ? static_cast<uint32_t>(std::atoi(timeString)) : 0u;
80   return time;
81 }
82
83 } // namespace
84
85 /**
86  * GlImplementation is a concrete implementation for GlAbstraction.
87  * The class provides an OpenGL-ES 2.0 or 3.0 implementation.
88  * The class is provided when creating the Integration::Core object.
89  */
90 class GlImplementation : public Dali::Integration::GlAbstraction
91 {
92 public:
93   GlImplementation()
94   : mGlExtensionSupportedCacheList(),
95     mContextCreatedWaitCondition(),
96     mMaxTextureSize(0),
97     mMaxCombinedTextureUnits(0),
98     mMaxTextureSamples(0),
99     mVertexShaderPrefix(""),
100     mGlesVersion(INITIAL_GLES_VERSION),
101     mShadingLanguageVersion(100),
102     mShadingLanguageVersionCached(false),
103     mIsSurfacelessContextSupported(false),
104     mIsContextCreated(false)
105   {
106     mImpl.reset(new Gles3Implementation());
107   }
108
109   virtual ~GlImplementation()
110   {
111   }
112
113   void PreRender() override
114   {
115     /* Do nothing in main implementation */
116   }
117
118   void PostRender() override
119   {
120     /* Do nothing in main implementation */
121   }
122
123   void ContextCreated()
124   {
125     glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
126     glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mMaxCombinedTextureUnits);
127
128     // Since gles 2.0 didn't return well for GL_MAJOR_VERSION and GL_MINOR_VERSION,
129     // Only change gles version for the device that support above gles 3.0.
130     if(mGlesVersion >= INITIAL_GLES_VERSION)
131     {
132       GLint majorVersion, minorVersion;
133       glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
134       glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
135       mGlesVersion = majorVersion * 10 + minorVersion;
136     }
137
138     if(mGlesVersion >= GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED)
139     {
140       SetIsAdvancedBlendEquationSupported(true);
141     }
142
143     if(mGlExtensionSupportedCacheList.NeedFullCheck())
144     {
145       // fully check gl extensions if we miss some extension supported
146       mGlExtensionSupportedCacheList.EnsureGlExtensionSupportedCheck();
147     }
148
149     if(IsMultisampledRenderToTextureSupported())
150     {
151       mMaxTextureSamples = 0;
152
153       if(mGlesVersion >= MINIMUM_GLES_VERSION_GET_MAXIMUM_MULTISAMPLES_TO_TEXTURE)
154       {
155         // Try to get maximum FBO MSAA sampling level from GL_RENDERBUFFER first.
156         // If false, than ask again to GL_MAX_SAMPLES_EXT.
157         GetInternalformativ(GL_RENDERBUFFER, GL_RGBA8, GL_SAMPLES, 1, &mMaxTextureSamples);
158       }
159       if(mMaxTextureSamples == 0)
160       {
161         glGetIntegerv(GL_MAX_SAMPLES_EXT, &mMaxTextureSamples);
162       }
163     }
164
165     if(!mShadingLanguageVersionCached)
166     {
167       std::istringstream shadingLanguageVersionStream(reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
168       std::string        token;
169       uint32_t           tokenCount = 0;
170       while(std::getline(shadingLanguageVersionStream, token, ' '))
171       {
172         if(tokenCount == 3 && token == "ES")
173         {
174           std::getline(shadingLanguageVersionStream, token, '.');
175           mShadingLanguageVersion = std::atoi(token.c_str());
176           mShadingLanguageVersion *= 100;
177           std::getline(shadingLanguageVersionStream, token, '.');
178           mShadingLanguageVersion += std::atoi(token.c_str());
179           break;
180         }
181         tokenCount++;
182       }
183     }
184
185     mLogThreshold = GetPerformanceLogThresholdTime();
186     mLogEnabled   = mLogThreshold > 0 ? true : false;
187
188     {
189       ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
190       mIsContextCreated = true;
191       mContextCreatedWaitCondition.Notify(lock);
192     }
193   }
194
195   void SetGlesVersion(const int32_t glesVersion)
196   {
197     if(mGlesVersion / 10 != glesVersion / 10)
198     {
199       mGlesVersion = glesVersion;
200       if(mGlesVersion >= 30)
201       {
202         mImpl.reset(new Gles3Implementation());
203       }
204       else
205       {
206         mImpl.reset(new Gles2Implementation());
207       }
208     }
209   }
210
211   void SetIsSurfacelessContextSupported(const bool isSupported)
212   {
213     mIsSurfacelessContextSupported = isSupported;
214   }
215
216   bool IsSurfacelessContextSupported() const override
217   {
218     return mIsSurfacelessContextSupported;
219   }
220
221   void SetIsAdvancedBlendEquationSupported(const bool isSupported)
222   {
223     mGlExtensionSupportedCacheList.MarkSupported(GlExtensionCache::GlExtensionCheckerType::BLEND_EQUATION_ADVANCED, isSupported);
224   }
225
226   bool IsAdvancedBlendEquationSupported()
227   {
228     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
229
230     const auto type = GlExtensionCache::GlExtensionCheckerType::BLEND_EQUATION_ADVANCED;
231     if(!mIsContextCreated && !mGlExtensionSupportedCacheList.IsCached(type))
232     {
233       mContextCreatedWaitCondition.Wait(lock);
234     }
235     return mGlExtensionSupportedCacheList.IsSupported(type);
236   }
237
238   void SetIsMultisampledRenderToTextureSupported(const bool isSupported)
239   {
240     mGlExtensionSupportedCacheList.MarkSupported(GlExtensionCache::GlExtensionCheckerType::MULTISAMPLED_RENDER_TO_TEXTURE, isSupported);
241   }
242
243   bool IsMultisampledRenderToTextureSupported()
244   {
245     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
246
247     const auto type = GlExtensionCache::GlExtensionCheckerType::MULTISAMPLED_RENDER_TO_TEXTURE;
248     if(!mIsContextCreated && !mGlExtensionSupportedCacheList.IsCached(type))
249     {
250       mContextCreatedWaitCondition.Wait(lock);
251     }
252     return mGlExtensionSupportedCacheList.IsSupported(type);
253   }
254
255   bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation)
256   {
257     switch(blendEquation)
258     {
259       case DevelBlendEquation::ADD:
260       case DevelBlendEquation::SUBTRACT:
261       case DevelBlendEquation::REVERSE_SUBTRACT:
262       {
263         return true;
264       }
265       case DevelBlendEquation::MIN:
266       case DevelBlendEquation::MAX:
267       {
268         return (GetGlesVersion() >= 30);
269       }
270       case DevelBlendEquation::MULTIPLY:
271       case DevelBlendEquation::SCREEN:
272       case DevelBlendEquation::OVERLAY:
273       case DevelBlendEquation::DARKEN:
274       case DevelBlendEquation::LIGHTEN:
275       case DevelBlendEquation::COLOR_DODGE:
276       case DevelBlendEquation::COLOR_BURN:
277       case DevelBlendEquation::HARD_LIGHT:
278       case DevelBlendEquation::SOFT_LIGHT:
279       case DevelBlendEquation::DIFFERENCE:
280       case DevelBlendEquation::EXCLUSION:
281       case DevelBlendEquation::HUE:
282       case DevelBlendEquation::SATURATION:
283       case DevelBlendEquation::COLOR:
284       case DevelBlendEquation::LUMINOSITY:
285       {
286         return IsAdvancedBlendEquationSupported();
287       }
288
289       default:
290       {
291         return false;
292       }
293     }
294
295     return false;
296   }
297
298   std::string GetShaderVersionPrefix()
299   {
300     if(mShaderVersionPrefix == "")
301     {
302       mShaderVersionPrefix = "#version " + std::to_string(GetShadingLanguageVersion());
303       if(GetShadingLanguageVersion() < 300)
304       {
305         mShaderVersionPrefix += "\n";
306       }
307       else
308       {
309         mShaderVersionPrefix += " es\n";
310       }
311     }
312     return mShaderVersionPrefix;
313   }
314
315   std::string GetVertexShaderPrefix()
316   {
317     if(mVertexShaderPrefix == "")
318     {
319       mVertexShaderPrefix = GetShaderVersionPrefix();
320
321       if(GetShadingLanguageVersion() < 300)
322       {
323         mVertexShaderPrefix += "#define INPUT attribute\n";
324         mVertexShaderPrefix += "#define OUTPUT varying\n";
325       }
326       else
327       {
328         mVertexShaderPrefix += "#define INPUT in\n";
329         mVertexShaderPrefix += "#define OUTPUT out\n";
330       }
331     }
332     return mVertexShaderPrefix;
333   }
334
335   std::string GetFragmentShaderPrefix()
336   {
337     if(mFragmentShaderPrefix == "")
338     {
339       mFragmentShaderPrefix = GetShaderVersionPrefix();
340
341       if(GetShadingLanguageVersion() < 300)
342       {
343         mFragmentShaderPrefix += "#define INPUT varying\n";
344         mFragmentShaderPrefix += "#define OUT_COLOR gl_FragColor\n";
345         mFragmentShaderPrefix += "#define TEXTURE texture2D\n";
346       }
347       else
348       {
349         mFragmentShaderPrefix += "#define INPUT in\n";
350         mFragmentShaderPrefix += "#define OUT_COLOR fragColor\n";
351         mFragmentShaderPrefix += "#define TEXTURE texture\n";
352
353         if(IsAdvancedBlendEquationSupported())
354         {
355           mFragmentShaderPrefix += FRAGMENT_SHADER_ADVANCED_BLEND_EQUATION_PREFIX;
356         }
357
358         mFragmentShaderPrefix += FRAGMENT_SHADER_OUTPUT_COLOR_STRING;
359       }
360     }
361     return mFragmentShaderPrefix;
362   }
363
364   bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override
365   {
366     bool convert = ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
367     if(mGlesVersion >= 30)
368     {
369       // Don't convert manually from RGB to RGBA if GLES >= 3.0 and a sub-image is uploaded.
370       convert = (convert && !isSubImage);
371     }
372     return convert;
373   }
374
375   int GetMaxTextureSize()
376   {
377     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
378     if(!mIsContextCreated)
379     {
380       mContextCreatedWaitCondition.Wait(lock);
381     }
382     return mMaxTextureSize;
383   }
384
385   int GetMaxCombinedTextureUnits()
386   {
387     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
388     if(!mIsContextCreated)
389     {
390       mContextCreatedWaitCondition.Wait(lock);
391     }
392     return mMaxCombinedTextureUnits;
393   }
394
395   int GetMaxTextureSamples()
396   {
397     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
398     if(!mIsContextCreated)
399     {
400       mContextCreatedWaitCondition.Wait(lock);
401     }
402     return mMaxTextureSamples;
403   }
404
405   int32_t GetGlesVersion()
406   {
407     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
408     if(!mIsContextCreated)
409     {
410       mContextCreatedWaitCondition.Wait(lock);
411     }
412     return mGlesVersion;
413   }
414
415   void SetShadingLanguageVersion(int shadingLanguageVersion)
416   {
417     mShadingLanguageVersion       = shadingLanguageVersion;
418     mShadingLanguageVersionCached = true;
419   }
420
421   int GetShadingLanguageVersion()
422   {
423     ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
424     if(!mIsContextCreated && !mShadingLanguageVersionCached)
425     {
426       mContextCreatedWaitCondition.Wait(lock);
427     }
428     return mShadingLanguageVersion;
429   }
430
431   bool ApplyNativeFragmentShader(std::string& shader, const char* customSamplerType)
432   {
433     bool        modified        = false;
434     std::string versionString   = "#version";
435     size_t      versionPosition = shader.find(versionString);
436     if(versionPosition != std::string::npos)
437     {
438       std::string extensionString;
439       size_t      shadingLanguageVersionPosition = shader.find_first_not_of(" \t", versionPosition + versionString.length());
440       if(shadingLanguageVersionPosition != std::string::npos &&
441          shader.substr(shadingLanguageVersionPosition, 3) == LEGACY_SHADING_LANGUAGE_VERSION)
442       {
443         extensionString = OES_EGL_IMAGE_EXTERNAL_STRING;
444       }
445       else
446       {
447         extensionString = OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3;
448       }
449
450       if(shader.find(extensionString) == std::string::npos)
451       {
452         modified                 = true;
453         size_t extensionPosition = shader.find_first_of("\n", versionPosition) + 1;
454         shader.insert(extensionPosition, extensionString);
455       }
456     }
457     else
458     {
459       if(shader.find(OES_EGL_IMAGE_EXTERNAL_STRING) == std::string::npos)
460       {
461         modified = true;
462         shader   = OES_EGL_IMAGE_EXTERNAL_STRING + shader;
463       }
464     }
465
466     if(shader.find(customSamplerType) == std::string::npos)
467     {
468       size_t pos = shader.find(DEFAULT_SAMPLER_TYPE);
469       if(pos != std::string::npos)
470       {
471         modified = true;
472         shader.replace(pos, strlen(DEFAULT_SAMPLER_TYPE), customSamplerType);
473       }
474     }
475
476     return modified;
477   }
478
479   /* OpenGL ES 2.0 */
480
481   void ActiveTexture(GLenum texture) override
482   {
483     glActiveTexture(texture);
484   }
485
486   void AttachShader(GLuint program, GLuint shader) override
487   {
488     glAttachShader(program, shader);
489   }
490
491   void BindAttribLocation(GLuint program, GLuint index, const char* name) override
492   {
493     glBindAttribLocation(program, index, name);
494   }
495
496   void BindBuffer(GLenum target, GLuint buffer) override
497   {
498     glBindBuffer(target, buffer);
499   }
500
501   void BindFramebuffer(GLenum target, GLuint framebuffer) override
502   {
503     glBindFramebuffer(target, framebuffer);
504   }
505
506   void BindRenderbuffer(GLenum target, GLuint renderbuffer) override
507   {
508     glBindRenderbuffer(target, renderbuffer);
509   }
510
511   void BindTexture(GLenum target, GLuint texture) override
512   {
513     glBindTexture(target, texture);
514   }
515
516   void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
517   {
518     glBlendColor(red, green, blue, alpha);
519   }
520
521   void BlendEquation(GLenum mode) override
522   {
523     glBlendEquation(mode);
524   }
525
526   void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) override
527   {
528     glBlendEquationSeparate(modeRGB, modeAlpha);
529   }
530
531   void BlendFunc(GLenum sfactor, GLenum dfactor) override
532   {
533     glBlendFunc(sfactor, dfactor);
534   }
535
536   void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) override
537   {
538     glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
539   }
540
541   void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) override
542   {
543     glBufferData(target, size, data, usage);
544   }
545
546   void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) override
547   {
548     glBufferSubData(target, offset, size, data);
549   }
550
551   GLenum CheckFramebufferStatus(GLenum target) override
552   {
553     return glCheckFramebufferStatus(target);
554   }
555
556   void Clear(GLbitfield mask) override
557   {
558     uint32_t startTime = 0, endTime = 0;
559     if(mLogEnabled)
560     {
561       startTime = TimeService::GetMilliSeconds();
562     }
563
564     glClear(mask);
565
566     if(mLogEnabled)
567     {
568       endTime = TimeService::GetMilliSeconds();
569       if(endTime - startTime > mLogThreshold)
570       {
571         DALI_LOG_DEBUG_INFO("glClear takes long time! [%u ms]\n", endTime - startTime);
572       }
573     }
574   }
575
576   void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override
577   {
578     glClearColor(red, green, blue, alpha);
579   }
580
581   void ClearDepthf(GLclampf depth) override
582   {
583     glClearDepthf(depth);
584   }
585
586   void ClearStencil(GLint s) override
587   {
588     glClearStencil(s);
589   }
590
591   void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override
592   {
593     glColorMask(red, green, blue, alpha);
594   }
595
596   void CompileShader(GLuint shader) override
597   {
598     glCompileShader(shader);
599   }
600
601   void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) override
602   {
603     glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
604   }
605
606   void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) override
607   {
608     glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
609   }
610
611   void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) override
612   {
613     glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
614   }
615
616   void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
617   {
618     glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
619   }
620
621   GLuint CreateProgram(void) override
622   {
623     return glCreateProgram();
624   }
625
626   GLuint CreateShader(GLenum type) override
627   {
628     return glCreateShader(type);
629   }
630
631   void CullFace(GLenum mode) override
632   {
633     glCullFace(mode);
634   }
635
636   void DeleteBuffers(GLsizei n, const GLuint* buffers) override
637   {
638     glDeleteBuffers(n, buffers);
639   }
640
641   void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) override
642   {
643     glDeleteFramebuffers(n, framebuffers);
644   }
645
646   void DeleteProgram(GLuint program) override
647   {
648     glDeleteProgram(program);
649   }
650
651   void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) override
652   {
653     glDeleteRenderbuffers(n, renderbuffers);
654   }
655
656   void DeleteShader(GLuint shader) override
657   {
658     glDeleteShader(shader);
659   }
660
661   void DeleteTextures(GLsizei n, const GLuint* textures) override
662   {
663     glDeleteTextures(n, textures);
664   }
665
666   void DepthFunc(GLenum func) override
667   {
668     glDepthFunc(func);
669   }
670
671   void DepthMask(GLboolean flag) override
672   {
673     glDepthMask(flag);
674   }
675
676   void DepthRangef(GLclampf zNear, GLclampf zFar) override
677   {
678     glDepthRangef(zNear, zFar);
679   }
680
681   void DetachShader(GLuint program, GLuint shader) override
682   {
683     glDetachShader(program, shader);
684   }
685
686   void Disable(GLenum cap) override
687   {
688     glDisable(cap);
689   }
690
691   void DisableVertexAttribArray(GLuint index) override
692   {
693     glDisableVertexAttribArray(index);
694   }
695
696   void DrawArrays(GLenum mode, GLint first, GLsizei count) override
697   {
698     glDrawArrays(mode, first, count);
699   }
700
701   void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) override
702   {
703     glDrawElements(mode, count, type, indices);
704   }
705
706   void Enable(GLenum cap) override
707   {
708     glEnable(cap);
709   }
710
711   void EnableVertexAttribArray(GLuint index) override
712   {
713     glEnableVertexAttribArray(index);
714   }
715
716   void Finish(void) override
717   {
718     glFinish();
719   }
720
721   void Flush(void) override
722   {
723     glFlush();
724   }
725
726   void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
727   {
728     glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
729   }
730
731   void FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) override
732   {
733     glFramebufferTexture2D(target, attachment, textarget, texture, level);
734   }
735
736   void FrontFace(GLenum mode) override
737   {
738     glFrontFace(mode);
739   }
740
741   void GenBuffers(GLsizei n, GLuint* buffers) override
742   {
743     glGenBuffers(n, buffers);
744   }
745
746   void GenerateMipmap(GLenum target) override
747   {
748     glGenerateMipmap(target);
749   }
750
751   void GenFramebuffers(GLsizei n, GLuint* framebuffers) override
752   {
753     glGenFramebuffers(n, framebuffers);
754   }
755
756   void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
757   {
758     glGenRenderbuffers(n, renderbuffers);
759   }
760
761   void GenTextures(GLsizei n, GLuint* textures) override
762   {
763     glGenTextures(n, textures);
764   }
765
766   void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
767   {
768     glGetActiveAttrib(program, index, bufsize, length, size, type, name);
769   }
770
771   void GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) override
772   {
773     glGetActiveUniform(program, index, bufsize, length, size, type, name);
774   }
775
776   void GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) override
777   {
778     glGetAttachedShaders(program, maxcount, count, shaders);
779   }
780
781   int GetAttribLocation(GLuint program, const char* name) override
782   {
783     return glGetAttribLocation(program, name);
784   }
785
786   void GetBooleanv(GLenum pname, GLboolean* params) override
787   {
788     glGetBooleanv(pname, params);
789   }
790
791   void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) override
792   {
793     glGetBufferParameteriv(target, pname, params);
794   }
795
796   GLenum GetError(void) override
797   {
798     return glGetError();
799   }
800
801   void GetFloatv(GLenum pname, GLfloat* params) override
802   {
803     glGetFloatv(pname, params);
804   }
805
806   void GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) override
807   {
808     glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
809   }
810
811   void GetIntegerv(GLenum pname, GLint* params) override
812   {
813     glGetIntegerv(pname, params);
814   }
815
816   void GetProgramiv(GLuint program, GLenum pname, GLint* params) override
817   {
818     glGetProgramiv(program, pname, params);
819   }
820
821   void GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) override
822   {
823     glGetProgramInfoLog(program, bufsize, length, infolog);
824   }
825
826   void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) override
827   {
828     glGetRenderbufferParameteriv(target, pname, params);
829   }
830
831   void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override
832   {
833     glGetShaderiv(shader, pname, params);
834   }
835
836   void GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) override
837   {
838     glGetShaderInfoLog(shader, bufsize, length, infolog);
839   }
840
841   void GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) override
842   {
843     glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
844   }
845
846   void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override
847   {
848     glGetShaderSource(shader, bufsize, length, source);
849   }
850
851   const GLubyte* GetString(GLenum name) override
852   {
853     return glGetString(name);
854   }
855
856   void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) override
857   {
858     glGetTexParameterfv(target, pname, params);
859   }
860
861   void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) override
862   {
863     glGetTexParameteriv(target, pname, params);
864   }
865
866   void GetUniformfv(GLuint program, GLint location, GLfloat* params) override
867   {
868     glGetUniformfv(program, location, params);
869   }
870
871   void GetUniformiv(GLuint program, GLint location, GLint* params) override
872   {
873     glGetUniformiv(program, location, params);
874   }
875
876   int GetUniformLocation(GLuint program, const char* name) override
877   {
878     return glGetUniformLocation(program, name);
879   }
880
881   void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) override
882   {
883     glGetVertexAttribfv(index, pname, params);
884   }
885
886   void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) override
887   {
888     glGetVertexAttribiv(index, pname, params);
889   }
890
891   void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) override
892   {
893     glGetVertexAttribPointerv(index, pname, pointer);
894   }
895
896   void Hint(GLenum target, GLenum mode) override
897   {
898     glHint(target, mode);
899   }
900
901   GLboolean IsBuffer(GLuint buffer) override
902   {
903     return glIsBuffer(buffer);
904   }
905
906   GLboolean IsEnabled(GLenum cap) override
907   {
908     return glIsEnabled(cap);
909   }
910
911   GLboolean IsFramebuffer(GLuint framebuffer) override
912   {
913     return glIsFramebuffer(framebuffer);
914   }
915
916   GLboolean IsProgram(GLuint program) override
917   {
918     return glIsProgram(program);
919   }
920
921   GLboolean IsRenderbuffer(GLuint renderbuffer) override
922   {
923     return glIsRenderbuffer(renderbuffer);
924   }
925
926   GLboolean IsShader(GLuint shader) override
927   {
928     return glIsShader(shader);
929   }
930
931   GLboolean IsTexture(GLuint texture) override
932   {
933     return glIsTexture(texture);
934   }
935
936   void LineWidth(GLfloat width) override
937   {
938     glLineWidth(width);
939   }
940
941   void LinkProgram(GLuint program) override
942   {
943     glLinkProgram(program);
944   }
945
946   void PixelStorei(GLenum pname, GLint param) override
947   {
948     glPixelStorei(pname, param);
949   }
950
951   void PolygonOffset(GLfloat factor, GLfloat units) override
952   {
953     glPolygonOffset(factor, units);
954   }
955
956   void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) override
957   {
958     glReadPixels(x, y, width, height, format, type, pixels);
959   }
960
961   void ReleaseShaderCompiler(void) override
962   {
963     glReleaseShaderCompiler();
964   }
965
966   void RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) override
967   {
968     glRenderbufferStorage(target, internalformat, width, height);
969   }
970
971   void SampleCoverage(GLclampf value, GLboolean invert) override
972   {
973     glSampleCoverage(value, invert);
974   }
975
976   void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override
977   {
978     glScissor(x, y, width, height);
979   }
980
981   void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override
982   {
983     glShaderBinary(n, shaders, binaryformat, binary, length);
984   }
985
986   void ShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) override
987   {
988     glShaderSource(shader, count, string, length);
989   }
990
991   void StencilFunc(GLenum func, GLint ref, GLuint mask) override
992   {
993     glStencilFunc(func, ref, mask);
994   }
995
996   void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override
997   {
998     glStencilFuncSeparate(face, func, ref, mask);
999   }
1000
1001   void StencilMask(GLuint mask) override
1002   {
1003     glStencilMask(mask);
1004   }
1005
1006   void StencilMaskSeparate(GLenum face, GLuint mask) override
1007   {
1008     glStencilMaskSeparate(face, mask);
1009   }
1010
1011   void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override
1012   {
1013     glStencilOp(fail, zfail, zpass);
1014   }
1015
1016   void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override
1017   {
1018     glStencilOpSeparate(face, fail, zfail, zpass);
1019   }
1020
1021   void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override
1022   {
1023     glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
1024   }
1025
1026   void TexParameterf(GLenum target, GLenum pname, GLfloat param) override
1027   {
1028     glTexParameterf(target, pname, param);
1029   }
1030
1031   void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) override
1032   {
1033     glTexParameterfv(target, pname, params);
1034   }
1035
1036   void TexParameteri(GLenum target, GLenum pname, GLint param) override
1037   {
1038     glTexParameteri(target, pname, param);
1039   }
1040
1041   void TexParameteriv(GLenum target, GLenum pname, const GLint* params) override
1042   {
1043     glTexParameteriv(target, pname, params);
1044   }
1045
1046   void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) override
1047   {
1048     glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
1049   }
1050
1051   void Uniform1f(GLint location, GLfloat x) override
1052   {
1053     glUniform1f(location, x);
1054   }
1055
1056   void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override
1057   {
1058     glUniform1fv(location, count, v);
1059   }
1060
1061   void Uniform1i(GLint location, GLint x) override
1062   {
1063     glUniform1i(location, x);
1064   }
1065
1066   void Uniform1iv(GLint location, GLsizei count, const GLint* v) override
1067   {
1068     glUniform1iv(location, count, v);
1069   }
1070
1071   void Uniform2f(GLint location, GLfloat x, GLfloat y) override
1072   {
1073     glUniform2f(location, x, y);
1074   }
1075
1076   void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override
1077   {
1078     glUniform2fv(location, count, v);
1079   }
1080
1081   void Uniform2i(GLint location, GLint x, GLint y) override
1082   {
1083     glUniform2i(location, x, y);
1084   }
1085
1086   void Uniform2iv(GLint location, GLsizei count, const GLint* v) override
1087   {
1088     glUniform2iv(location, count, v);
1089   }
1090
1091   void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override
1092   {
1093     glUniform3f(location, x, y, z);
1094   }
1095
1096   void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override
1097   {
1098     glUniform3fv(location, count, v);
1099   }
1100
1101   void Uniform3i(GLint location, GLint x, GLint y, GLint z) override
1102   {
1103     glUniform3i(location, x, y, z);
1104   }
1105
1106   void Uniform3iv(GLint location, GLsizei count, const GLint* v) override
1107   {
1108     glUniform3iv(location, count, v);
1109   }
1110
1111   void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
1112   {
1113     glUniform4f(location, x, y, z, w);
1114   }
1115
1116   void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override
1117   {
1118     glUniform4fv(location, count, v);
1119   }
1120
1121   void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override
1122   {
1123     glUniform4i(location, x, y, z, w);
1124   }
1125
1126   void Uniform4iv(GLint location, GLsizei count, const GLint* v) override
1127   {
1128     glUniform4iv(location, count, v);
1129   }
1130
1131   void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1132   {
1133     glUniformMatrix2fv(location, count, transpose, value);
1134   }
1135
1136   void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1137   {
1138     glUniformMatrix3fv(location, count, transpose, value);
1139   }
1140
1141   void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1142   {
1143     glUniformMatrix4fv(location, count, transpose, value);
1144   }
1145
1146   void UseProgram(GLuint program) override
1147   {
1148     glUseProgram(program);
1149   }
1150
1151   void ValidateProgram(GLuint program) override
1152   {
1153     glValidateProgram(program);
1154   }
1155
1156   void VertexAttrib1f(GLuint indx, GLfloat x) override
1157   {
1158     glVertexAttrib1f(indx, x);
1159   }
1160
1161   void VertexAttrib1fv(GLuint indx, const GLfloat* values) override
1162   {
1163     glVertexAttrib1fv(indx, values);
1164   }
1165
1166   void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) override
1167   {
1168     glVertexAttrib2f(indx, x, y);
1169   }
1170
1171   void VertexAttrib2fv(GLuint indx, const GLfloat* values) override
1172   {
1173     glVertexAttrib2fv(indx, values);
1174   }
1175
1176   void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) override
1177   {
1178     glVertexAttrib3f(indx, x, y, z);
1179   }
1180
1181   void VertexAttrib3fv(GLuint indx, const GLfloat* values) override
1182   {
1183     glVertexAttrib3fv(indx, values);
1184   }
1185
1186   void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
1187   {
1188     glVertexAttrib4f(indx, x, y, z, w);
1189   }
1190
1191   void VertexAttrib4fv(GLuint indx, const GLfloat* values) override
1192   {
1193     glVertexAttrib4fv(indx, values);
1194   }
1195
1196   void VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) override
1197   {
1198     glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
1199   }
1200
1201   void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
1202   {
1203     glViewport(x, y, width, height);
1204   }
1205
1206   /* OpenGL ES 3.0 */
1207
1208   void ReadBuffer(GLenum mode) override
1209   {
1210     mImpl->ReadBuffer(mode);
1211   }
1212
1213   void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) override
1214   {
1215     mImpl->DrawRangeElements(mode, start, end, count, type, indices);
1216   }
1217
1218   void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) override
1219   {
1220     mImpl->TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
1221   }
1222
1223   void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) override
1224   {
1225     mImpl->TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
1226   }
1227
1228   void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) override
1229   {
1230     mImpl->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
1231   }
1232
1233   void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) override
1234   {
1235     mImpl->CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
1236   }
1237
1238   void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) override
1239   {
1240     mImpl->CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
1241   }
1242
1243   void GenQueries(GLsizei n, GLuint* ids) override
1244   {
1245     mImpl->GenQueries(n, ids);
1246   }
1247
1248   void DeleteQueries(GLsizei n, const GLuint* ids) override
1249   {
1250     mImpl->DeleteQueries(n, ids);
1251   }
1252
1253   GLboolean IsQuery(GLuint id) override
1254   {
1255     return mImpl->IsQuery(id);
1256   }
1257
1258   void BeginQuery(GLenum target, GLuint id) override
1259   {
1260     mImpl->BeginQuery(target, id);
1261   }
1262
1263   void EndQuery(GLenum target) override
1264   {
1265     mImpl->EndQuery(target);
1266   }
1267
1268   void GetQueryiv(GLenum target, GLenum pname, GLint* params) override
1269   {
1270     mImpl->GetQueryiv(target, pname, params);
1271   }
1272
1273   void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) override
1274   {
1275     mImpl->GetQueryObjectuiv(id, pname, params);
1276   }
1277
1278   GLboolean UnmapBuffer(GLenum target) override
1279   {
1280     return mImpl->UnmapBuffer(target);
1281   }
1282
1283   void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) override
1284   {
1285     mImpl->GetBufferPointerv(target, pname, params);
1286   }
1287
1288   void DrawBuffers(GLsizei n, const GLenum* bufs) override
1289   {
1290     mImpl->DrawBuffers(n, bufs);
1291   }
1292
1293   void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1294   {
1295     mImpl->UniformMatrix2x3fv(location, count, transpose, value);
1296   }
1297
1298   void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1299   {
1300     mImpl->UniformMatrix3x2fv(location, count, transpose, value);
1301   }
1302
1303   void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1304   {
1305     mImpl->UniformMatrix2x4fv(location, count, transpose, value);
1306   }
1307
1308   void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1309   {
1310     mImpl->UniformMatrix4x2fv(location, count, transpose, value);
1311   }
1312
1313   void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1314   {
1315     mImpl->UniformMatrix3x4fv(location, count, transpose, value);
1316   }
1317
1318   void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
1319   {
1320     mImpl->UniformMatrix4x3fv(location, count, transpose, value);
1321   }
1322
1323   void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override
1324   {
1325     mImpl->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1326   }
1327
1328   void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) override
1329   {
1330     mImpl->RenderbufferStorageMultisample(target, samples, internalformat, width, height);
1331   }
1332
1333   void FramebufferTexture2DMultisample(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) override
1334   {
1335     mImpl->FramebufferTexture2DMultisample(target, attachment, textarget, texture, level, samples);
1336   }
1337
1338   void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) override
1339   {
1340     mImpl->FramebufferTextureLayer(target, attachment, texture, level, layer);
1341   }
1342
1343   GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) override
1344   {
1345     return mImpl->MapBufferRange(target, offset, length, access);
1346   }
1347
1348   void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) override
1349   {
1350     mImpl->FlushMappedBufferRange(target, offset, length);
1351   }
1352
1353   void BindVertexArray(GLuint array) override
1354   {
1355     mImpl->BindVertexArray(array);
1356   }
1357
1358   void DeleteVertexArrays(GLsizei n, const GLuint* arrays) override
1359   {
1360     mImpl->DeleteVertexArrays(n, arrays);
1361   }
1362
1363   void GenVertexArrays(GLsizei n, GLuint* arrays) override
1364   {
1365     mImpl->GenVertexArrays(n, arrays);
1366   }
1367
1368   GLboolean IsVertexArray(GLuint array) override
1369   {
1370     return mImpl->IsVertexArray(array);
1371   }
1372
1373   void GetIntegeri_v(GLenum target, GLuint index, GLint* data) override
1374   {
1375     mImpl->GetIntegeri_v(target, index, data);
1376   }
1377
1378   void BeginTransformFeedback(GLenum primitiveMode) override
1379   {
1380     mImpl->BeginTransformFeedback(primitiveMode);
1381   }
1382
1383   void EndTransformFeedback(void) override
1384   {
1385     mImpl->EndTransformFeedback();
1386   }
1387
1388   void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) override
1389   {
1390     mImpl->BindBufferRange(target, index, buffer, offset, size);
1391   }
1392
1393   void BindBufferBase(GLenum target, GLuint index, GLuint buffer) override
1394   {
1395     mImpl->BindBufferBase(target, index, buffer);
1396   }
1397
1398   void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) override
1399   {
1400     mImpl->TransformFeedbackVaryings(program, count, varyings, bufferMode);
1401   }
1402
1403   void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) override
1404   {
1405     mImpl->GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
1406   }
1407
1408   void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) override
1409   {
1410     mImpl->VertexAttribIPointer(index, size, type, stride, pointer);
1411   }
1412
1413   void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) override
1414   {
1415     mImpl->GetVertexAttribIiv(index, pname, params);
1416   }
1417
1418   void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) override
1419   {
1420     mImpl->GetVertexAttribIuiv(index, pname, params);
1421   }
1422
1423   void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) override
1424   {
1425     mImpl->VertexAttribI4i(index, x, y, z, w);
1426   }
1427
1428   void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) override
1429   {
1430     mImpl->VertexAttribI4ui(index, x, y, z, w);
1431   }
1432
1433   void VertexAttribI4iv(GLuint index, const GLint* v) override
1434   {
1435     mImpl->VertexAttribI4iv(index, v);
1436   }
1437
1438   void VertexAttribI4uiv(GLuint index, const GLuint* v) override
1439   {
1440     mImpl->VertexAttribI4uiv(index, v);
1441   }
1442
1443   void GetUniformuiv(GLuint program, GLint location, GLuint* params) override
1444   {
1445     mImpl->GetUniformuiv(program, location, params);
1446   }
1447
1448   GLint GetFragDataLocation(GLuint program, const GLchar* name) override
1449   {
1450     return mImpl->GetFragDataLocation(program, name);
1451   }
1452
1453   void Uniform1ui(GLint location, GLuint v0) override
1454   {
1455     mImpl->Uniform1ui(location, v0);
1456   }
1457
1458   void Uniform2ui(GLint location, GLuint v0, GLuint v1) override
1459   {
1460     mImpl->Uniform2ui(location, v0, v1);
1461   }
1462
1463   void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) override
1464   {
1465     mImpl->Uniform3ui(location, v0, v1, v2);
1466   }
1467
1468   void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) override
1469   {
1470     mImpl->Uniform4ui(location, v0, v1, v2, v3);
1471   }
1472
1473   void Uniform1uiv(GLint location, GLsizei count, const GLuint* value) override
1474   {
1475     mImpl->Uniform1uiv(location, count, value);
1476   }
1477
1478   void Uniform2uiv(GLint location, GLsizei count, const GLuint* value) override
1479   {
1480     mImpl->Uniform2uiv(location, count, value);
1481   }
1482
1483   void Uniform3uiv(GLint location, GLsizei count, const GLuint* value) override
1484   {
1485     mImpl->Uniform3uiv(location, count, value);
1486   }
1487
1488   void Uniform4uiv(GLint location, GLsizei count, const GLuint* value) override
1489   {
1490     mImpl->Uniform4uiv(location, count, value);
1491   }
1492
1493   void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) override
1494   {
1495     mImpl->ClearBufferiv(buffer, drawbuffer, value);
1496   }
1497
1498   void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) override
1499   {
1500     mImpl->ClearBufferuiv(buffer, drawbuffer, value);
1501   }
1502
1503   void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) override
1504   {
1505     mImpl->ClearBufferfv(buffer, drawbuffer, value);
1506   }
1507
1508   void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override
1509   {
1510     mImpl->ClearBufferfi(buffer, drawbuffer, depth, stencil);
1511   }
1512
1513   const GLubyte* GetStringi(GLenum name, GLuint index) override
1514   {
1515     return mImpl->GetStringi(name, index);
1516   }
1517
1518   void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) override
1519   {
1520     mImpl->CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
1521   }
1522
1523   void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) override
1524   {
1525     mImpl->GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
1526   }
1527
1528   void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) override
1529   {
1530     mImpl->GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
1531   }
1532
1533   GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) override
1534   {
1535     return mImpl->GetUniformBlockIndex(program, uniformBlockName);
1536   }
1537
1538   void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) override
1539   {
1540     mImpl->GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
1541   }
1542
1543   void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) override
1544   {
1545     mImpl->GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
1546   }
1547
1548   void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override
1549   {
1550     mImpl->UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
1551   }
1552
1553   void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) override
1554   {
1555     mImpl->DrawArraysInstanced(mode, first, count, instanceCount);
1556   }
1557
1558   void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) override
1559   {
1560     mImpl->DrawElementsInstanced(mode, count, type, indices, instanceCount);
1561   }
1562
1563   GLsync FenceSync(GLenum condition, GLbitfield flags) override
1564   {
1565     return mImpl->FenceSync(condition, flags);
1566   }
1567
1568   GLboolean IsSync(GLsync sync) override
1569   {
1570     return mImpl->IsSync(sync);
1571   }
1572
1573   void DeleteSync(GLsync sync) override
1574   {
1575     mImpl->DeleteSync(sync);
1576   }
1577
1578   GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1579   {
1580     return mImpl->ClientWaitSync(sync, flags, timeout);
1581   }
1582
1583   void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override
1584   {
1585     mImpl->WaitSync(sync, flags, timeout);
1586   }
1587
1588   void GetInteger64v(GLenum pname, GLint64* params) override
1589   {
1590     mImpl->GetInteger64v(pname, params);
1591   }
1592
1593   void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) override
1594   {
1595     mImpl->GetSynciv(sync, pname, bufSize, length, values);
1596   }
1597
1598   void GetInteger64i_v(GLenum target, GLuint index, GLint64* data) override
1599   {
1600     mImpl->GetInteger64i_v(target, index, data);
1601   }
1602
1603   void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override
1604   {
1605     mImpl->GetBufferParameteri64v(target, pname, params);
1606   }
1607
1608   void GenSamplers(GLsizei count, GLuint* samplers) override
1609   {
1610     mImpl->GenSamplers(count, samplers);
1611   }
1612
1613   void DeleteSamplers(GLsizei count, const GLuint* samplers) override
1614   {
1615     mImpl->DeleteSamplers(count, samplers);
1616   }
1617
1618   GLboolean IsSampler(GLuint sampler) override
1619   {
1620     return mImpl->IsSampler(sampler);
1621   }
1622
1623   void BindSampler(GLuint unit, GLuint sampler) override
1624   {
1625     mImpl->BindSampler(unit, sampler);
1626   }
1627
1628   void SamplerParameteri(GLuint sampler, GLenum pname, GLint param) override
1629   {
1630     mImpl->SamplerParameteri(sampler, pname, param);
1631   }
1632
1633   void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) override
1634   {
1635     mImpl->SamplerParameteriv(sampler, pname, param);
1636   }
1637
1638   void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) override
1639   {
1640     mImpl->SamplerParameterf(sampler, pname, param);
1641   }
1642
1643   void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) override
1644   {
1645     mImpl->SamplerParameterfv(sampler, pname, param);
1646   }
1647
1648   void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) override
1649   {
1650     mImpl->GetSamplerParameteriv(sampler, pname, params);
1651   }
1652
1653   void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) override
1654   {
1655     mImpl->GetSamplerParameterfv(sampler, pname, params);
1656   }
1657
1658   void VertexAttribDivisor(GLuint index, GLuint divisor) override
1659   {
1660     mImpl->VertexAttribDivisor(index, divisor);
1661   }
1662
1663   void BindTransformFeedback(GLenum target, GLuint id) override
1664   {
1665     mImpl->BindTransformFeedback(target, id);
1666   }
1667
1668   void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) override
1669   {
1670     mImpl->DeleteTransformFeedbacks(n, ids);
1671   }
1672
1673   void GenTransformFeedbacks(GLsizei n, GLuint* ids) override
1674   {
1675     mImpl->GenTransformFeedbacks(n, ids);
1676   }
1677
1678   GLboolean IsTransformFeedback(GLuint id) override
1679   {
1680     return mImpl->IsTransformFeedback(id);
1681   }
1682
1683   void PauseTransformFeedback(void) override
1684   {
1685     mImpl->PauseTransformFeedback();
1686   }
1687
1688   void ResumeTransformFeedback(void) override
1689   {
1690     mImpl->ResumeTransformFeedback();
1691   }
1692
1693   void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) override
1694   {
1695     mImpl->GetProgramBinary(program, bufSize, length, binaryFormat, binary);
1696   }
1697
1698   void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) override
1699   {
1700     mImpl->ProgramBinary(program, binaryFormat, binary, length);
1701   }
1702
1703   void ProgramParameteri(GLuint program, GLenum pname, GLint value) override
1704   {
1705     mImpl->ProgramParameteri(program, pname, value);
1706   }
1707
1708   void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) override
1709   {
1710     mImpl->InvalidateFramebuffer(target, numAttachments, attachments);
1711   }
1712
1713   void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) override
1714   {
1715     mImpl->InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
1716   }
1717
1718   void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) override
1719   {
1720     mImpl->TexStorage2D(target, levels, internalformat, width, height);
1721   }
1722
1723   void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) override
1724   {
1725     mImpl->TexStorage3D(target, levels, internalformat, width, height, depth);
1726   }
1727
1728   void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) override
1729   {
1730     mImpl->GetInternalformativ(target, internalformat, pname, bufSize, params);
1731   }
1732
1733   void BlendBarrier(void)
1734   {
1735     if(mGlExtensionSupportedCacheList.IsSupported(GlExtensionCache::GlExtensionCheckerType::BLEND_EQUATION_ADVANCED))
1736     {
1737       mImpl->BlendBarrier();
1738     }
1739   }
1740
1741 private:
1742   std::unique_ptr<GlesAbstraction> mImpl;
1743
1744   GlExtensionCache::GlExtensionSupportedCacheList mGlExtensionSupportedCacheList;
1745
1746   ConditionalWait mContextCreatedWaitCondition;
1747   GLint           mMaxTextureSize;
1748   GLint           mMaxCombinedTextureUnits;
1749   GLint           mMaxTextureSamples;
1750   std::string     mShaderVersionPrefix;
1751   std::string     mVertexShaderPrefix;
1752   std::string     mFragmentShaderPrefix;
1753   int32_t         mGlesVersion;
1754   int32_t         mShadingLanguageVersion;
1755   uint32_t        mLogThreshold{0};
1756   bool            mShadingLanguageVersionCached;
1757   bool            mIsSurfacelessContextSupported;
1758   bool            mIsContextCreated;
1759   bool            mLogEnabled{false};
1760 };
1761
1762 } // namespace Adaptor
1763
1764 } // namespace Internal
1765
1766 } // namespace Dali
1767
1768 #endif // DALI_INTERNAL_GL_IMPLEMENTATION_H